From e2b5ad2524646eb29769396cf2e38442c20ea828 Mon Sep 17 00:00:00 2001 From: Daniel Cojocea Date: Wed, 24 Jul 2024 15:07:00 -0400 Subject: [PATCH] Added fix to searching for admin role --- Client/src/Components/NavBar/index.jsx | 4 ++-- Client/src/Pages/Account/index.jsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Client/src/Components/NavBar/index.jsx b/Client/src/Components/NavBar/index.jsx index e58ec7dac..e1501ea48 100644 --- a/Client/src/Components/NavBar/index.jsx +++ b/Client/src/Components/NavBar/index.jsx @@ -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. * diff --git a/Client/src/Pages/Account/index.jsx b/Client/src/Pages/Account/index.jsx index 24514da60..ad5acf53a 100644 --- a/Client/src/Pages/Account/index.jsx +++ b/Client/src/Pages/Account/index.jsx @@ -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 ( { - { user.role[0] === "admin" && } + { user.role.includes("admin") && } );