Refactor - Static nav links through page meta config
Created by: deepakduggirala
Instead of importing nav store and using nav.setNavItems
, static nav breadcrumbs can be set through route meta data.
<route lang="yaml">
meta:
title: Users
requiresRoles: ["operator", "admin"]
nav: [{label: "Users"}]
</route>
router.beforeEach((to) => {
if (to?.meta?.nav) {
nav.setNavItems(to.meta.nav);
} else {
nav.resetNavItems();
}
});
router.beforeEach needs to registered in main.js to be able to run when directly loading the specific url
may depend on https://github.com/IUSCA/bioloop/issues/69