Skip to content

Commit c6d745e

Browse files
authored
adding admin mode to the authwrapper (#951)
1 parent ab57861 commit c6d745e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
import React from "react";
2+
import {useSelector} from "react-redux";
3+
import {RootState} from "../../types/data";
4+
5+
26

37
export const AuthWrapper = (props): JSX.Element => {
4-
const { currRole, allowedRoles, children } = props;
5-
return <>{allowedRoles.includes(currRole) ? children : <></>}</>;
6-
};
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

Comments
 (0)