import{a as s}from"./axios-4a70c6fc.js";import{E as o}from"./index-ad591d72.js";const t=s.create({baseURL:"https://api.feibot.com",timeout:6e4});t.interceptors.request.use(function(e){return localStorage.getItem("token")&&(e.headers.Authorization=localStorage.getItem("token")),e},function(e){return Promise.reject(e)});t.interceptors.response.use(function(e){return e.status==200?e.data.code&&e.data.code!=200?(o.error(e.data.message),Promise.reject(e.data)):e.data.error?(o.error(e.data.error),Promise.reject(e.data)):e.data:(o.error(e.data.message),Promise.reject(e.data))},function(e){var r;return console.log("错误",e),e.response.status==401?(localStorage.removeItem("token"),location.hash="#/index/tools/clock/login",Promise.reject((r=e.response.data)==null?void 0:r.error)):(e.code=="ERR_NETWORK"?o({message:"Do not disable the back-end network service",grouping:!0,type:"error"}):e.code=="ERR_BAD_REQUEST"&&o({message:e.message,grouping:!0,type:"error"}),Promise.reject(e))});const u=e=>t({url:"/register",method:"post",data:e}),n=e=>t({url:"/login",method:"post",data:e}),l=e=>t({url:`/users?page=${e}`,method:"get"}),d=(e,r)=>t({url:`/user/${e}`,method:"put",data:r}),i=e=>t({url:`/user/${e}`,method:"delete"}),m=e=>t({url:"/addClockToUser",method:"post",data:e}),g=(e,r)=>t({url:`/clocks?page=${e}&searchValue=${r}`,method:"get"}),h=(e,r)=>t({url:`/clock/${e}`,method:"put",data:r}),k=e=>t({url:`/clock/${e}`,method:"delete"}),f=(e,r)=>t({url:"/clockController",method:"post",params:{Port:e,Message:r}});export{g as a,m as b,i as c,k as d,h as e,d as f,l as g,n as l,u as r,f as s};
