I need to show/hide different menu based on rights that are send from database and saved in localStorage.
Here is the imported menus
import tripOrders from './tripOrders';
import orders from './orders';
import employees from './employees';
Then I use them here:
const menuItems = {
items: [tripOrders, orders, employees]
};
I tried to make something like this, but nothing happens.
let menuFromDB = localStorage.getItem('menu-items') // <== in 'menu-items' I set tripOrders, orders, employees
const menuItems = {
items: [menuFromDB]
};
You get a string from localStorage, so you can use split() to convert it to the array