Load namespaces from inside the navigation component

This commit is contained in:
kolaente 2020-11-01 17:30:23 +01:00
parent 35400fcc0a
commit a3315f6408
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 4 additions and 15 deletions

View File

@ -87,10 +87,6 @@ export default {
) {
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() {
@ -156,23 +152,13 @@ export default {
keyboardShortcutsActive: KEYBOARD_SHORTCUTS_ACTIVE,
}),
methods: {
loadNamespaces() {
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) {
doStuffAfterRoute() {
// this.setTitle('') // Reset the title if the page component does not set one itself
if (this.$store.state[IS_FULLPAGE]) {
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 (window.innerWidth < 770) {
this.$store.commit(MENU_ACTIVE, false)

View File

@ -154,6 +154,9 @@ export default {
background: 'background',
menuActive: MENU_ACTIVE,
}),
beforeCreate() {
this.$store.dispatch('namespaces/loadNamespaces')
},
methods: {
toggleFavoriteList(list) {
// The favorites pseudo list is always favorite