1 |
- import{aZ as r,a_ as f,a$ as h,l as E,b0 as T,b1 as u,b2 as g,b3 as m,ap as k,X as l,ag as p,b4 as _,s as d}from"./index.f47bb45b.js";const{VITE_PROXY_DOMAIN_REAL:S,VITE_PROXY_USER_REAL:A}=f(),I=S,R=A+"/admin/",y=e=>r.request("post",`${I}/Api/login`,{data:e}),P=e=>r.request("post",`${R}/Admin/menu`,{data:e}),U=e=>r.request("post","/refreshToken",{data:e}),O=h(),b=E({id:"pure-user",state:()=>({token:T(),name:"admin",verifyCode:"",currentPage:0,userInfo:O||null}),actions:{SET_TOKEN(e){this.token=e},SET_NAME(e){this.name=e},SET_VERIFYCODE(e){this.verifyCode=e},SET_CURRENTPAGE(e){this.currentPage=e},SET_USERINFO(e){this.userInfo=e},async loginByUsername(e){return new Promise((t,n)=>{y(e).then(s=>{const{code:o,data:a}=s;if(o===0){const{token:i,userinfo:c}=a;u(i),g(c),t(s)}else t(s)}).catch(s=>{n(s)})})},async postMenuList(e){return new Promise((t,n)=>{P(e).then(s=>{const{code:o,data:a}=s;t(s)}).catch(s=>{n(s)})})},logOut(){this.token="",this.name="",m(),k.clear(),l().handleTags("equal",p),_.push("/login")},async refreshToken(e){return U(e).then(t=>{if(t)return u(t),t})}}});function M(){return b(d)}export{b as a,M as u};
|