import{i as e,n as t,r as n,t as r}from"./middleware-B51zI-ZM.js";import{t as i}from"./request-Vytbr90w.js";async function a(){return i({url:`/system/user/role`,method:`get`})}async function o(){return i({url:`/system/user/dept`,method:`get`})}async function s(e){return i({url:`/system/resetPassword`,method:`put`,data:e})}async function c(e){return i({url:`/system/login`,method:`post`,data:e})}async function l(){return i({url:`/system/logout`,method:`post`})}async function u(){return i({url:`/system/info`,method:`get`})}async function d(){return i({url:`/system/menu`,method:`get`})}async function f(e){return i({url:`/system/updateInfo`,method:`put`,data:e})}async function p(e){return i({url:`/system/updatePassword`,method:`put`,data:e})}async function m(){return i({url:`/system/loginRecord`})}var h={userinfo:{},access:[]},g=(e,t)=>({userId:()=>t().userinfo.id,setAccess:t=>e({access:t}),login:async e=>{let{data:t}=await c(e);localStorage.setItem(`token`,t.data.token)},logout:async()=>{await l(),localStorage.removeItem(`token`),e(h)},info:async()=>{let t=(await u()).data.data;e({userinfo:t.info,access:t.access})}}),_=e()(t(n((...e)=>({...h,...g(...e)}),{name:`auth-storage`,storage:r(()=>localStorage)}),{name:`XinAdmin-Auth`}));export{s as a,p as c,d as i,o as n,a as o,m as r,f as s,_ as t};