32 lines
633 B
TypeScript
Raw Normal View History

2024-04-11 13:07:43 +08:00
import { defineStore } from "pinia";
/**
*
* @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 = "";
}
},
persist: {
2024-04-28 14:28:26 +08:00
key: "user-info"
2024-04-11 13:07:43 +08:00
}
});