From 5fff68bb13dc88b22290c570cec28465599a62d2 Mon Sep 17 00:00:00 2001 From: chme Date: Sat, 6 Jul 2019 12:54:33 +0200 Subject: [PATCH] [web-src] Consolidate burger menu handling on route change in router/index.js --- web-src/src/App.vue | 3 --- web-src/src/router/index.js | 9 +++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/web-src/src/App.vue b/web-src/src/App.vue index 324fea86..b84c1e18 100644 --- a/web-src/src/App.vue +++ b/web-src/src/App.vue @@ -182,9 +182,6 @@ export default { }, watch: { - '$route' (to, from) { - this.$store.commit(types.SHOW_BURGER_MENU, false) - }, 'show_burger_menu' () { if (this.show_burger_menu) { document.querySelector('html').classList.add('is-clipped') diff --git a/web-src/src/router/index.js b/web-src/src/router/index.js index 233230fb..1ea4cc7b 100644 --- a/web-src/src/router/index.js +++ b/web-src/src/router/index.js @@ -247,10 +247,7 @@ export const router = new VueRouter({ }) router.beforeEach((to, from, next) => { - if (store.state.show_burger_menu) { - store.commit(types.SHOW_BURGER_MENU, false) - next(false) - } else { - next() - } + const burgerMenuVisible = store.state.show_burger_menu + store.commit(types.SHOW_BURGER_MENU, false) + next(!burgerMenuVisible) })