Added fix to searching for admin role

This commit is contained in:
Daniel Cojocea
2024-07-24 15:07:00 -04:00
parent a10b831744
commit e2b5ad2524
2 changed files with 4 additions and 4 deletions

View File

@@ -51,9 +51,9 @@ function NavBar() {
const authState = useSelector((state) => state.auth);
let settings = ["Profile", "Password", "Team", "Logout"];
if (authState.user.role[0] !== "admin")
if (!authState.user.role.includes("admin"))
settings = ["Profile", "Password", "Logout"];
/**
* Handles opening the user menu.
*

View File

@@ -26,7 +26,7 @@ const Account = ({ open = "profile" }) => {
let tabList = ["Profile", "Password", "Team"];
const { user } = useSelector((state) => state.auth);
if (user.role[0] !== "admin") tabList = ["Profile", "Password"];
if (!user.role.includes("admin")) tabList = ["Profile", "Password"];
return (
<Box
@@ -74,7 +74,7 @@ const Account = ({ open = "profile" }) => {
</Box>
<ProfilePanel />
<PasswordPanel />
{ user.role[0] === "admin" && <TeamPanel />}
{ user.role.includes("admin") && <TeamPanel />}
</TabContext>
</Box>
);