import h from"./Bvs3L9q-.js";import{Y as x,b as v,c as S,s as y,d as B,f as C,r as b,i as j,j as k,p as t,C as I,n as R}from"./BCLrUOBx.js";import"./CWalxxGV.js";const F={__name:"FollowBtn",props:{color:{type:String,default:""},storeId:{required:!0},following:{type:Boolean,default:!1}},emits:["change-following"],setup(n,{emit:l}){const r=n,c=l,{color:i,storeId:u,following:e}=x(r),f=v(),{postRequest:m}=f,p=S(),{authenticated:g}=y(p),{t:a}=B(),d=C(()=>e.value?a("store.following"):a("store.follow")),o=b(!1),w=async()=>{if(!g.value)return R("/login");o.value=!0;const s=await m({params:{store_id:u.value},api:"followStore"});o.value=!1,s.status===200&&c("change-following")};return(s,T)=>{const _=h;return k(),j(_,{class:I({following:t(e)}),type:"button",color:t(i),"loading-text":" ","fetching-data":t(o),text:d.value,onClicked:w},null,8,["class","color","fetching-data","text"])}}};export{F as default};
