Fixed hardcoded array access

This commit is contained in:
Alex Holliday committed 2024-09-24 13:34:56 +08:00
1 parent 4b35811897
commit e8183cc4f3
1 file changed
+3 -2
+3 -2
View File
@@ -93,8 +93,9 @@ function Sidebar() {
const { user } = useSelector((state) => state.auth);
// Remove demo password if demo
if (user.role?.includes("demo")) {
menu[3].nested = menu[3].nested.filter((item) => {
const accountMenuItem = menu.find((item) => item.name === "account");
if (user.role?.includes("demo") && accountMenuItem) {
accountMenuItem.nested = accountMenuItem.nested.filter((item) => {
return item.name !== "Password";
});
}