chore(auth): 解决ts 类型检查报错

This commit is contained in:
2026-01-22 14:38:19 +08:00
parent d712f9a5bf
commit be5078ae0d
5 changed files with 15 additions and 6 deletions

View File

@@ -27,11 +27,15 @@ interface BasicUserInfo {
/**
* 用户角色
*/
role?: string;
roles?: string[];
/**
* 用户状态
*/
state?: string;
/**
* 首页路径
*/
homePath?: string;
}
type ClassType = Array<object | string> | object | string;

View File

@@ -10,7 +10,7 @@ interface AccessState {
/**
* 用户角色
*/
userRoles: string;
userRoles: string[];
}
/**
@@ -22,12 +22,12 @@ export const useUserStore = defineStore('core-user', {
// 设置用户信息
this.userInfo = userInfo;
// 设置角色信息
const roles = userInfo?.role ?? '';
const roles = userInfo?.roles ?? [];
// 存储信息到本地
localStorage.setItem('userInfo', JSON.stringify(userInfo));
this.setUserRoles(roles);
},
setUserRoles(roles: string) {
setUserRoles(roles: string[]) {
this.userRoles = roles;
},
},