2 lines
1.5 KiB
JavaScript
2 lines
1.5 KiB
JavaScript
import{X as e}from"./index-DrZc8biM.js";const t="http://localhost:8080".replace(/\/$/,""),s=`${t}/api`,a=t=>new Promise((a,r)=>{e({url:s+t.url,method:t.method||"GET",data:t.data||{},header:t.header||{},success:e=>a(e.data),fail:e=>r(e)})}),r=(e,t={})=>{const s=Object.entries(t).filter(([,e])=>null!=e).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&");return a({url:`${e}${s?"?"+s:""}`,method:"GET"})},o=(e,t={})=>a({url:e,method:"POST",data:t,header:{"Content-Type":"application/json"}}),n=(e,t={})=>a({url:e,method:"PUT",data:t,header:{"Content-Type":"application/json"}}),p=e=>a({url:e,method:"DELETE"}),d=e=>e?e.startsWith("http")?e:`${t}${e}`:"",i=e=>o("/sms/send",{phone:e}),l=(e,t)=>o("/user/login",{phone:e,code:t}),c=e=>o("/user/register-boss",e),u=e=>o("/user/register-staff",e),m=(e,t)=>r("/appointment/list",{userId:e,storeId:t}),h=e=>o("/appointment/create",e),f=(e,t)=>o("/appointment/start",{appointmentId:e,staffUserId:t}),$=e=>n(`/appointment/status?id=${e}&status=cancel`),I=e=>o("/report/create",e),T=e=>r("/report/get",{token:e}),j=e=>r("/report/list",e),g=e=>r("/service-type/list",{storeId:e}),y=(e,t)=>o("/service-type/create",{storeId:e,name:t}),E=e=>p(`/service-type/delete?id=${e}`),C=e=>r("/user/staff-list",{storeId:e}),U=e=>o("/user/create-staff",e),b=e=>p(`/user/staff?staffId=${e}`),v=e=>n("/user/update",e),P=e=>n("/store/update",e);export{t as A,s as B,u as a,g as b,f as c,$ as d,h as e,I as f,m as g,C as h,d as i,b as j,U as k,l,E as m,y as n,j as o,v as p,T as q,c as r,i as s,P as u};
|