-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tab can only use display none to hide (#976)
- Loading branch information
1 parent
48a04cd
commit 9e5fcce
Showing
4 changed files
with
67 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import React from "react"; | ||
import { useSelector } from "react-redux"; | ||
import { RootState } from "../../types/data"; | ||
import { authCheck } from "../../utils/common"; | ||
|
||
export const AuthWrapper = (props): JSX.Element => { | ||
const { currRole, allowedRoles, children } = props; | ||
const adminMode = useSelector((state: RootState) => state.user.adminMode); | ||
|
||
return <>{adminMode || allowedRoles.includes(currRole) ? children : <></>}</>; | ||
return <>{authCheck(adminMode, currRole, allowedRoles) ? children : <></>}</>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters