fix(通用模块): 未登入访问对应模块url时,报错Network Error

This commit is contained in:
chenjianxing 2023-04-16 18:09:33 +08:00 committed by 刘瑞斌
parent da9fa08cae
commit dadf5fc7fb
1 changed files with 3 additions and 0 deletions

View File

@ -3,6 +3,9 @@ import {getCurrentProjectID, getCurrentUser, getCurrentWorkspaceId} from "./toke
export function hasPermission(permission) { export function hasPermission(permission) {
let user = getCurrentUser(); let user = getCurrentUser();
if (!user || !user.groups) {
return false;
}
let index = user.groups.findIndex(g => g.id === SUPER_GROUP); let index = user.groups.findIndex(g => g.id === SUPER_GROUP);
if (index !== -1) { if (index !== -1) {
return true; return true;