Load namespaces from inside the navigation component
This commit is contained in:
parent
35400fcc0a
commit
a3315f6408
16
src/App.vue
16
src/App.vue
|
@ -87,10 +87,6 @@ export default {
|
||||||
) {
|
) {
|
||||||
router.push({name: 'user.login'})
|
router.push({name: 'user.login'})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.userAuthenticated && this.userInfo.type === authTypes.USER && (this.$route.params.name === 'home' || this.namespaces.length === 0)) {
|
|
||||||
this.loadNamespaces()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -156,23 +152,13 @@ export default {
|
||||||
keyboardShortcutsActive: KEYBOARD_SHORTCUTS_ACTIVE,
|
keyboardShortcutsActive: KEYBOARD_SHORTCUTS_ACTIVE,
|
||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
loadNamespaces() {
|
doStuffAfterRoute() {
|
||||||
this.$store.dispatch('namespaces/loadNamespaces')
|
|
||||||
},
|
|
||||||
loadNamespacesIfNeeded(e) {
|
|
||||||
if (this.userAuthenticated && (this.userInfo && this.userInfo.type === authTypes.USER) && (e.name === 'home' || this.namespaces.length === 0)) {
|
|
||||||
this.loadNamespaces()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
doStuffAfterRoute(e) {
|
|
||||||
// this.setTitle('') // Reset the title if the page component does not set one itself
|
// this.setTitle('') // Reset the title if the page component does not set one itself
|
||||||
|
|
||||||
if (this.$store.state[IS_FULLPAGE]) {
|
if (this.$store.state[IS_FULLPAGE]) {
|
||||||
this.$store.commit(IS_FULLPAGE, false)
|
this.$store.commit(IS_FULLPAGE, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadNamespacesIfNeeded(e)
|
|
||||||
|
|
||||||
// If the menu is active on desktop, don't hide it because that would confuse the user
|
// If the menu is active on desktop, don't hide it because that would confuse the user
|
||||||
if (window.innerWidth < 770) {
|
if (window.innerWidth < 770) {
|
||||||
this.$store.commit(MENU_ACTIVE, false)
|
this.$store.commit(MENU_ACTIVE, false)
|
||||||
|
|
|
@ -154,6 +154,9 @@ export default {
|
||||||
background: 'background',
|
background: 'background',
|
||||||
menuActive: MENU_ACTIVE,
|
menuActive: MENU_ACTIVE,
|
||||||
}),
|
}),
|
||||||
|
beforeCreate() {
|
||||||
|
this.$store.dispatch('namespaces/loadNamespaces')
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toggleFavoriteList(list) {
|
toggleFavoriteList(list) {
|
||||||
// The favorites pseudo list is always favorite
|
// The favorites pseudo list is always favorite
|
||||||
|
|
Reference in New Issue