界面跳转问题

This commit is contained in:
2023-03-16 09:44:55 +08:00
parent d5d019bfaf
commit 8b6fb450a6
3 changed files with 7 additions and 4 deletions

View File

@@ -83,10 +83,12 @@ export const logOut = (commit) => {
export const setUserInfo = (res, commit) => {
// 如果没有任何权限,则赋予一个默认的权限,避免请求死循环
if (res.roles.length === 0) {
if (res.roles && res.roles.length > 0) {
commit('SET_ROLES', res.roles)
} else if (res.permissions.length === 0) {
commit('SET_ROLES', ['ROLE_SYSTEM_DEFAULT'])
} else {
commit('SET_ROLES', res.roles)
commit('SET_ROLES', res.permissions)
}
commit('SET_USER', res.user)
}