import{O as a,P as e,Q as t,H as s,R as r,a as o,q as i}from"./index-BmnJ93Po.js";const d="/api",c="",n="/mes",l="/mes";function u(u,f,p={},m={}){return new Promise(((g,h)=>{const T=a("token"),E={"Content-Type":"application/json;charset=UTF-8",Authorization:"Bearer "+T},P=Object.assign({},E,m);let b="";b=u.includes("/v1")?c:"/fabric/info/all"===u||"/color/list"===u||u.includes("/fabric/info/craftPrice")?n:u.includes("fabric/craft")?l:d,"/upload"===u?e({url:b+u,file:p,header:{Authorization:"Bearer "+T},success:a=>{let e=JSON.parse(a.data);g(e)}}):t({url:b+u,method:f,data:p,header:P,success:a=>{var e;a.data&&200===a.data.code?g(a.data):a.data&&401===a.data.code?(s({icon:"error",title:"登录过期！"}),r(),o({url:"/pages/login/login"}),h(new Error("请求失败: "+(a.data&&(null==(e=a.data)?void 0:e.message)||"未知错误")))):a.data&&401===a.data.code?s({icon:"error",title:"暂无权限！"}):7778===a.data.code||7777===a.data.code?g(a.data):i(a.data.msg)},fail:a=>{h(a)}})}))}const f=(a,e={},t={})=>u(a,"POST",e,t),p=(a,e={},t={})=>u(a,"GET",e,t),m=(a,e={},t={})=>u(a,"PUT",e,t),g=(a,e={},t={})=>u(a,"DELETE",e,t),h=(a,e={})=>u(a,"",e);export{m as a,g as d,p as g,f as p,h as u};
