navigation permission and ability checker

This commit is contained in:
Julian Krauser 2024-08-26 17:56:07 +02:00
parent cb80771f7a
commit 35cba95887
6 changed files with 213 additions and 92 deletions

View file

@ -28,6 +28,7 @@ import { useNavigationStore } from "@/stores/admin/navigation";
import SidebarLayout from "@/layouts/Sidebar.vue";
import SidebarTemplate from "@/templates/Sidebar.vue";
import RoutingLink from "@/components/admin/RoutingLink.vue";
import { useAbilityStore } from "../../stores/ability";
</script>
<script lang="ts">
@ -57,13 +58,26 @@ export default defineComponent({
},
},
created() {
useAbilityStore().$subscribe(() => {
this.updateTopLevel();
this.updateNavigation();
});
this.updateTopLevel();
this.updateNavigation();
this.setLink(this.activeTopLevelObject.levelDefault);
},
beforeUnmount() {
this.resetNavigation();
},
methods: {
...mapActions(useNavigationStore, ["setLink", "resetNavigation", "setTopLevel"]),
...mapActions(useNavigationStore, [
"setLink",
"resetNavigation",
"setTopLevel",
"updateTopLevel",
"updateNavigation",
]),
},
});
</script>