import{ref as a}from"vue";import{defineStore as e}from"pinia";import{b as t,k as s}from"./server.mjs";const o=e("contact",(()=>{const{locale:e}=t(),{$axios:o}=s(),n=a({}),r=a(!1),i=a(!0),p=a(!1);let u=a(),c=a(1),m=a();const l=a([]);return{errors:n,isLoading:r,pendingState:p,isLoading2:i,getContact:async function(a,t){r.value=!0;try{let s=new FormData;if(s.append("name",a.name),s.append("phone",`+966${a.phone}`),s.append("email",a.email),s.append("message",a.message),(await o.post("contact",s)).status>=200){r.value=!1,n.value=void 0;const a=await import("mosha-vue-toastify"),{createToast:s}=a;s("ar"==e.value?"تم التواصل بنجاح ":"Communication was successful",{toastBackgroundColor:"#00A0B4",position:"top-right",type:"success",transition:"bounce",showIcon:"true",timeout:3e3}),t({values:{email:"",name:"",message:""},errors:{}})}}catch(a){a.response&&(r.value=!1,n.value=a.response.data.errors)}},questions:l,page:c,total:u,per_page:m,getQuestions:async function(a){try{const e=await o.get("questions",{params:{page:a}});e.status>=200&&(i.value=!1,l.value=[...l.value,...e.data.data],u.value=e.data.meta.total,m.value=e.data.meta.per_page)}catch(a){a.response&&(i.value=!1)}}}}));export{o as L};
