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
897 B
JavaScript
2 lines
897 B
JavaScript
import{aw as u,J as i,ar as o,aE as a,aF as n,aG as h,aq as c,a5 as g,aj as l,as as m,aC as T,L as f}from"./index-93dfb385.js";const p=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(a))==null?void 0:e.username)??"",roles:((r=o().getItem(a))==null?void 0:r.roles)??[],currentPage:0}},actions:{SET_USERNAME(e){this.username=e},SET_ROLES(e){this.roles=e},SET_CURRENTPAGE(e){this.currentPage=e},async loginByUsername(e){return new Promise((r,t)=>{p(e).then(s=>{s&&(n(s.data.token),h(s.data),r(s))}).catch(s=>{t(s)})})},logOut(){this.username="",this.roles=[],c(),g().handleTags("equal",[...l]),m(),T.push("/login")},async handRefreshToken(e){return new Promise((r,t)=>{E(e).then(s=>{s&&(n(s.data),r(s))}).catch(s=>{t(s)})})}}});function R(){return S(f)}export{R as u};
|