0
0
Fork 0

feat: #7648 handle LeftMenu

This commit is contained in:
Javier Segarra 2024-06-29 00:07:00 +02:00
parent e418a647be
commit 361024abe2
2 changed files with 6 additions and 3 deletions

View File

@ -9,6 +9,7 @@ import { toLowerCamel } from 'src/filters';
import routes from 'src/router/modules';
import LeftMenuItem from './LeftMenuItem.vue';
import LeftMenuItemGroup from './LeftMenuItemGroup.vue';
import { useRole } from 'src/composables/useRole';
const { t } = useI18n();
const route = useRoute();
@ -58,6 +59,8 @@ function addChildren(module, route, parent) {
}
const items = ref([]);
const role = useRole();
function getRoutes() {
if (props.source === 'main') {
const modules = Object.assign([], navigation.getModules().value);
@ -66,9 +69,9 @@ function getRoutes() {
const moduleDef = routes.find(
(route) => toLowerCamel(route.name) === item.module
);
item.children = [];
if (!moduleDef) continue;
if (!role.isEmployee()) continue;
item.children = [];
addChildren(item.module, moduleDef, item.children);
}

View File

@ -80,7 +80,7 @@ export const useNavigationStore = defineStore('navigationStore', () => {
}
async function fetchPinned() {
if (pinnedModules.value.length) return;
if (pinnedModules.value.length || !role.isEmployee()) return;
const response = await axios.get('StarredModules/getStarredModules');
pinnedModules.value = response.data.map((row) => row.moduleFk);