[web-src] Consolidate burger menu handling on route change in router/index.js

This commit is contained in:
chme 2019-07-06 12:54:33 +02:00
parent 79f3faf991
commit 5fff68bb13
2 changed files with 3 additions and 9 deletions

View File

@ -182,9 +182,6 @@ export default {
}, },
watch: { watch: {
'$route' (to, from) {
this.$store.commit(types.SHOW_BURGER_MENU, false)
},
'show_burger_menu' () { 'show_burger_menu' () {
if (this.show_burger_menu) { if (this.show_burger_menu) {
document.querySelector('html').classList.add('is-clipped') document.querySelector('html').classList.add('is-clipped')

View File

@ -247,10 +247,7 @@ export const router = new VueRouter({
}) })
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
if (store.state.show_burger_menu) { const burgerMenuVisible = store.state.show_burger_menu
store.commit(types.SHOW_BURGER_MENU, false) store.commit(types.SHOW_BURGER_MENU, false)
next(false) next(!burgerMenuVisible)
} else {
next()
}
}) })