Simplify tab check

This commit is contained in:
Alex Holliday committed 2024-09-06 12:01:58 -07:00
1 parent 6fc06ab9b6
commit 00074e039e
1 file changed
+6 -6
+6 -6
View File
@@ -24,18 +24,18 @@ const Account = ({ open = "profile" }) => {
}; };
const { user } = useSelector((state) => state.auth); const { user } = useSelector((state) => state.auth);
let tabList = ["Profile", "Team", "Password"];
// Remove passwrod for demo
if (user.role.includes("demo")) {
tabList = tabList.filter((tab) => tab !== "Password");
}
const requiredRoles = ["superadmin", "admin"]; const requiredRoles = ["superadmin", "admin"];
let tabList = ["Profile", "Team", "Password"];
const hideTeams = !requiredRoles.some((role) => user.role.includes(role)); const hideTeams = !requiredRoles.some((role) => user.role.includes(role));
if (hideTeams) { if (hideTeams) {
tabList = ["Profile", "Password"]; tabList = ["Profile", "Password"];
} }
// Remove passwrod for demo
if (user.role.includes("demo")) {
tabList = ["Profile"];
}
return ( return (
<Box <Box
className="account" className="account"