Browse Source

refactor: 隔离sso多系统基础数据

master
wangxiang 2 years ago
parent
commit
55113d97a1
No known key found for this signature in database
GPG Key ID: 1BA7946AB6B232E4
  1. 7
      src/store/modules/user.ts

7
src/store/modules/user.ts

@ -159,6 +159,8 @@ export const useUserStore = defineStore({ @@ -159,6 +159,8 @@ export const useUserStore = defineStore({
/** 获取用户信息 */
async getUserInfoAction(): Promise<User> {
const { apiUrl } = useGlobSetting();
const { t } = useI18n();
try {
const userInfo = await getUserInfo();
userInfo.avatar = userInfo.avatar
? isUrl(userInfo.avatar)
@ -171,6 +173,11 @@ export const useUserStore = defineStore({ @@ -171,6 +173,11 @@ export const useUserStore = defineStore({
this.setRoleIds(userInfo.roleIds);
this.setPermissions(userInfo.permissions);
return userInfo;
} catch (e) {
// 防止 system-biz 微服务挂掉后导致token授权成功重新登陆覆盖授权客户端密钥
this.resetState();
throw Error(t('sys.api.errMsg503'));
}
},
/** 登出 */
async logout(goLogin = false) {

Loading…
Cancel
Save