31 lines
697 B
TypeScript
Raw Normal View History

2024-04-11 13:07:43 +08:00
import { defineStore } from "pinia";
2024-04-29 11:58:26 +08:00
import persistedstateConfig from "@/store/config/index";
2024-04-11 13:07:43 +08:00
/**
*
* @methods setAccount
* @methods setToken token
* @methods logOut 退
*/
2024-04-28 14:28:26 +08:00
export const useUserInfoStore = defineStore("user-info", {
2024-04-11 13:07:43 +08:00
state: (): any => ({
account: {
username: "",
roles: []
}, // 账号信息
token: "" // token
}),
actions: {
async setAccount(data: Array<string>) {
this.account = data;
},
async setToken(data: string) {
this.token = data;
},
async logOut() {
this.account = {};
this.token = "";
}
},
2024-04-29 11:58:26 +08:00
persist: persistedstateConfig("user-info")
2024-04-11 13:07:43 +08:00
});