feat: 初始化
This commit is contained in:
38
stores/user.ts
Normal file
38
stores/user.ts
Normal file
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @description 用户信息数据持久化
|
||||
*/
|
||||
import { getUserInfo } from '@/services/user';
|
||||
import type { Customer, IB } from '@/types/user';
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
export const useUserStore = defineStore('user', {
|
||||
state() {
|
||||
return {
|
||||
token: undefined,
|
||||
userInfo: {},
|
||||
a:{},
|
||||
ibFund: {},
|
||||
currentRow: {}
|
||||
};
|
||||
},
|
||||
actions: {
|
||||
setUserInfo(data: Customer | IB) {
|
||||
this.userInfo = data;
|
||||
},
|
||||
setIbFund(data: Record<string, any>) {
|
||||
this.ibFund = data;
|
||||
},
|
||||
setToken(token: string) {
|
||||
this.token = token;
|
||||
},
|
||||
clear() {
|
||||
this.userInfo = {};
|
||||
this.ibFund = {};
|
||||
this.a = {};
|
||||
this.token = undefined;
|
||||
},
|
||||
setCurrentRow(data: Record<string, any>) {
|
||||
this.currentRow = data;
|
||||
}
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user