visuddhinanda 2 лет назад
Родитель
Сommit
0f095e3258
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      dashboard/src/reducers/current-user.ts

+ 3 - 3
dashboard/src/reducers/current-user.ts

@@ -39,7 +39,7 @@ export interface IUser {
   nickName: string;
   nickName: string;
   realName: string;
   realName: string;
   avatar: string;
   avatar: string;
-  roles: string[];
+  roles: string[] | null;
 }
 }
 
 
 interface IState {
 interface IState {
@@ -70,9 +70,9 @@ export const slice = createSlice({
 export const { signIn, signOut, guest } = slice.actions;
 export const { signIn, signOut, guest } = slice.actions;
 
 
 export const isRoot = (state: RootState): boolean =>
 export const isRoot = (state: RootState): boolean =>
-  state.currentUser.payload?.roles.includes(ROLE_ROOT) || false;
+  state.currentUser.payload?.roles?.includes(ROLE_ROOT) || false;
 export const isAdministrator = (state: RootState): boolean =>
 export const isAdministrator = (state: RootState): boolean =>
-  state.currentUser.payload?.roles.includes(ROLE_ADMINISTRATOR) || false;
+  state.currentUser.payload?.roles?.includes(ROLE_ADMINISTRATOR) || false;
 export const currentUser = (state: RootState): IUser | undefined =>
 export const currentUser = (state: RootState): IUser | undefined =>
   state.currentUser.payload;
   state.currentUser.payload;
 export const isGuest = (state: RootState): boolean | undefined =>
 export const isGuest = (state: RootState): boolean | undefined =>