芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/public_html/invoicer.pulsehost.co.uk/public/build/assets/global-hjd3yXo5.js
import{h as i}from"./auth-BcagBUX6.js";import{s as r,u as d}from"./main-WS8l16KQ.js";const u={name:null,phone:null,address_street_1:null,address_street_2:null,city:null,state:null,country_id:null,zip:null,type:null},{defineStore:m}=window.pinia,h=m({id:"customerUserStore",state:()=>({customers:[],userForm:{avatar:null,name:"",email:"",password:"",company:"",confirm_password:"",billing:{...u},shipping:{...u}}}),actions:{copyAddress(){this.userForm.shipping={...this.userForm.billing,type:"shipping"}},fetchCurrentUser(){const e=l();return new Promise((n,t)=>{r.get(`/api/v1/${e.companySlug}/customer/me`).then(o=>{Object.assign(this.userForm,o.data.data),n(o)}).catch(o=>{i(o),t(o)})})},updateCurrentUser({data:e,message:n}){const t=l();return new Promise((o,a)=>{r.post(`/api/v1/${t.companySlug}/customer/profile`,e).then(s=>{this.userForm=s.data.data,t.currentUser=s.data.data,o(s),n&&d(!0).showNotification({type:"success",message:n})}).catch(s=>{i(s),a(s)})})}}}),{defineStore:p}=window.pinia,{global:c}=window.i18n,l=p({id:"CustomerPortalGlobalStore",state:()=>({languages:[],currency:null,isAppLoaded:!1,countries:[],getDashboardDataLoaded:!1,currentUser:null,companySlug:"",mainMenu:null,enabledModules:[]}),actions:{bootstrap(e){this.companySlug=e;const n=h();return new Promise((t,o)=>{r.get(`/api/v1/${e}/customer/bootstrap`).then(a=>{this.currentUser=a.data.data,this.mainMenu=a.data.meta.menu,this.currency=a.data.data.currency,this.enabledModules=a.data.meta.modules,Object.assign(n.userForm,a.data.data),typeof c.locale!="string"&&(c.locale.value=a.data.meta.current_company_language||"en"),this.isAppLoaded=!0,t(a)}).catch(a=>{i(a),o(a)})})},fetchCountries(){return new Promise((e,n)=>{this.countries.length?e(this.countries):r.get(`/api/v1/${this.companySlug}/customer/countries`).then(t=>{this.countries=t.data.data,e(t)}).catch(t=>{i(t),n(t)})})}}});export{h as a,l as u};