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
950 B
JavaScript
2 lines
950 B
JavaScript
import{aB as u,l as i,ap as o,aI as n,aJ as a,aK as h,ao as l,a0 as T,af as g,aq as c,L as m,s as p}from "./index-f5e1fd05.js";const f= e=>u.request("post","/virtual-patient/user/login",{data:e}),E= e=>u.request("post","/refreshToken",{data:e}),S=i({id:"pure-user",state:()=>{var e,r;return{username:((e=o().getItem(n))==null?void 0:e.username)??"",roles:((r=o().getItem(n))==null?void 0:r.roles)??[],currentPage:0,loginType:"0"}},actions:{SET_USERNAME(e){this.username=e},SET_ROLES(e){this.roles=e},SET_CURRENTPAGE(e){this.currentPage=e},SET_LOGINTYPE(e){this.loginType=e},async loginByUsername(e){return new Promise((r, t)=>{f(e).then(s=>{s&&(a(s.data.token),h(s.data),r(s))}).catch(s=>{t(s)})})},logOut(){this.username="",this.roles=[],l(),T().handleTags("equal",[...g]),c(),m.push("/login")},async handRefreshToken(e){return new Promise((r, t)=>{E(e).then(s=>{s&&(a(s.data),r(s))}).catch(s=>{t(s)})})}}});function y(){return S(p)}export{y as u};
|