navigation enhancement
This commit is contained in:
parent
2853835d31
commit
b3125a26da
3 changed files with 11 additions and 7 deletions
|
@ -21,7 +21,7 @@
|
|||
</div>
|
||||
<div class="px-1 py-1 w-full flex flex-col gap-2">
|
||||
<MenuItem v-slot="{ close }">
|
||||
<RouterLink to="/account">
|
||||
<RouterLink to="/account/me">
|
||||
<button button primary @click="close">Mein Account</button>
|
||||
</RouterLink>
|
||||
</MenuItem>
|
||||
|
|
|
@ -46,7 +46,7 @@ export const useNavigationStore = defineStore("navigation", {
|
|||
resetNavigation() {
|
||||
this.$reset();
|
||||
},
|
||||
updateTopLevel(first: boolean = false) {
|
||||
updateTopLevel() {
|
||||
const abilityStore = useAbilityStore();
|
||||
this.topLevel = [
|
||||
...(abilityStore.canSection("read", "club")
|
||||
|
@ -82,7 +82,7 @@ export const useNavigationStore = defineStore("navigation", {
|
|||
router.push({ name: `admin-${this.topLevel[0]?.key ?? "club"}-default` });
|
||||
}
|
||||
},
|
||||
updateNavigation(first: boolean = false) {
|
||||
updateNavigation() {
|
||||
const abilityStore = useAbilityStore();
|
||||
this.navigation = {
|
||||
club: {
|
||||
|
@ -129,8 +129,12 @@ export const useNavigationStore = defineStore("navigation", {
|
|||
],
|
||||
},
|
||||
} as navigationModel;
|
||||
if (this.activeNavigationObject.main.findIndex((e) => e.key == this.activeLink) == -1) {
|
||||
router.push({ name: `admin-${this.activeNavigation}-default` });
|
||||
if (
|
||||
this.activeNavigationObject.main.findIndex((e) => e.key == this.activeLink) == -1 ||
|
||||
this.activeLink == "default"
|
||||
) {
|
||||
let link = this.activeNavigationObject.main[0].key;
|
||||
router.push({ name: `admin-${this.activeNavigation}-${link}` });
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
@ -58,8 +58,8 @@ export default defineComponent({
|
|||
this.updateTopLevel();
|
||||
this.updateNavigation();
|
||||
});
|
||||
this.updateTopLevel(true);
|
||||
this.updateNavigation(true);
|
||||
this.updateTopLevel();
|
||||
this.updateNavigation();
|
||||
},
|
||||
beforeUnmount() {
|
||||
this.resetNavigation();
|
||||
|
|
Loading…
Reference in a new issue