We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ab57861 commit c6d745eCopy full SHA for c6d745e
frontend/src/components/auth/AuthWrapper.tsx
@@ -1,6 +1,16 @@
1
import React from "react";
2
+import {useSelector} from "react-redux";
3
+import {RootState} from "../../types/data";
4
+
5
6
7
export const AuthWrapper = (props): JSX.Element => {
- const { currRole, allowedRoles, children } = props;
- return <>{allowedRoles.includes(currRole) ? children : <></>}</>;
-};
8
+ const {currRole, allowedRoles, children} = props;
9
+ const adminMode = useSelector((state: RootState) => state.user.adminMode);
10
11
+ return (
12
+ <>
13
+ {(adminMode || allowedRoles.includes(currRole)) ? children : <></>}
14
+ </>
15
+ );
16
+}
0 commit comments