You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
555 B
JavaScript

import{p as e,A as o,u as s,v as t,s as a}from"./index-46d4z6wp.js";const n=n=>new Promise((r,i)=>{const c=e("token"),d={"Content-Type":"application/json",...n.header||{}};c&&(d.Authorization=`Bearer ${c}`),o({url:"/api"+n.url,method:n.method||"POST",data:n.data||{},header:d,success:e=>{if(401===e.statusCode)return s("token"),t({url:"/pages/login/login"}),void i(new Error("登录已过期"));const o=e.data;o.success?r(o):(a({title:o.message||"请求失败",icon:"none"}),i(o))},fail:e=>{a({title:"网络错误",icon:"none"}),i(e)}})});export{n as r};