Browse Source

fix: ensure that roleList is not empty

vben 3 years ago
parent
commit
aebad61b3d
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/store/modules/permission.ts

+ 1 - 1
src/store/modules/permission.ts

@@ -91,7 +91,7 @@ export const usePermissionStore = defineStore({
       const appStore = useAppStoreWidthOut();
 
       let routes: AppRouteRecordRaw[] = [];
-      const roleList = toRaw(userStore.getRoleList);
+      const roleList = toRaw(userStore.getRoleList) || [];
       const { permissionMode = projectSetting.permissionMode } = appStore.getProjectConfig;
       // role permissions
       if (permissionMode === PermissionModeEnum.ROLE) {