import{B as s,L as c,r as u,c as o,w as f,u as n}from"./index-fNs72j9w.js";import{d as h}from"./vue-DweYBrEc.js";const i=h("baAccount",{state:()=>({id:0,username:"",nickname:"",email:"",mobile:"",avatar:"",gender:0,birthday:"",money:0,score:0,motto:"",token:"",refresh_token:""}),actions:{dataFill(e,t=!0){t===!0?t=["token","refresh_token"]:t===!1&&(t=[]),Array.isArray(t)&&t.forEach(r=>{delete e[r]}),this.$patch(e)},removeToken(){this.token="",this.refresh_token=""},getGenderIcon(){let e={name:"fa fa-transgender-alt",color:"var(--el-text-color-secondary)"};switch(this.gender){case 1:e={name:"fa fa-mars-stroke-v",color:"var(--el-color-primary)"};break;case 2:e={name:"fa fa-mars-stroke",color:"var(--el-color-danger)"};break}return e},setToken(e,t){const r=t=="auth"?"token":"refresh_token";this[r]=e},getToken(e="auth"){return e==="auth"?this.token:this.refresh_token},logout(){l().then(e=>{e.code==1&&(c.remove(s),u.go(0))})}},persist:{key:s}}),a="/admin/Index/";function d(){return o({url:a+"index",method:"get"})}function g(e,t={}){return o({url:a+"login",data:t,method:e})}function p(){const e=f();return o({url:a+"logout",method:"POST",data:{refreshToken:e.getToken("refresh")}})}function A(e={}){const t=n();return o({url:t.apiUrl+"/api/user/checkIn",data:e,method:"post"},{showSuccessMessage:!0})}function T(){const e=i(),t=n();return o({url:t.apiUrl+"/api/user/info",method:"get"},{anotherToken:e.getToken("auth")})}function l(){const e=n(),t=i();return o({url:e.apiUrl+"/api/user/logout",method:"POST",data:{refreshToken:t.getToken("refresh")}})}export{p as a,A as b,T as c,d as i,g as l,i as u};
