From b4a7d2e10c252a619d2ff21eb87d68bc677eeaba Mon Sep 17 00:00:00 2001 From: yinbangzhong <zhongbangyin@126.com> Date: 星期六, 24 八月 2024 21:22:12 +0800 Subject: [PATCH] bug fix --- src/store/modules/user/index.ts | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/store/modules/user/index.ts b/src/store/modules/user/index.ts index e7ae4eb..426abc7 100644 --- a/src/store/modules/user/index.ts +++ b/src/store/modules/user/index.ts @@ -75,8 +75,10 @@ avatar: res.data.avatar, name: res.data.nickname, email: res.data.email, + role: res.data.roles[0].roleKey, }; - if(res.data.roles && res.data.roles.length>0) + + if(res.data?.roles.length>0) this.resources=res.data.roles[0].resources; setUserInfo(JSON.stringify(userInfo)); setUserResources(JSON.stringify(this.resources)) -- Gitblit v1.8.0