39 lines
739 B
TypeScript
39 lines
739 B
TypeScript
![]() |
/**
|
||
|
* @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;
|
||
|
}
|
||
|
}
|
||
|
});
|