登录跳转

This commit is contained in:
2022-12-30 08:57:42 +08:00
parent 911e9f73c3
commit 829b5f2c57

View File

@@ -89,13 +89,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)
}
if (res.depts && res.roles.length > 0) {
commit('SET_DEPTS', res.depts)
commit('SET_ROLES', res.permissions)
}
commit('SET_USER', res.user)
}