Skip to content
Snippets Groups Projects
Commit 611cab8f authored by Henrik Askjer's avatar Henrik Askjer
Browse files

preserve state by using boolean variable and $router.go()

parent b50a24be
No related branches found
No related tags found
No related merge requests found
......@@ -103,7 +103,7 @@ export default {
watch: {
$route(to, from) {
if (to.name == "about" && from.name != to.name) {
this.$store.commit('setDictRoute', from.fullPath)
this.$store.commit('toggle', 'aboutOpen')
}
}
}
......
......@@ -6,7 +6,7 @@
<v-spacer/>
<v-divider vertical/>
<v-toolbar-items v-if="$route.name == 'about'">
<v-btn text @click.native="back" v-if="$store.state.dictRoute">{{$t('close')}}<v-icon right>close</v-icon></v-btn>
<v-btn text @click.native="back" v-if="$store.state.aboutOpen">{{$t('close')}}<v-icon right>close</v-icon></v-btn>
<v-btn text v-else @click.native="home">Søk i ordbøkene<v-icon right>search</v-icon></v-btn>
</v-toolbar-items>
<v-toolbar-items>
......@@ -58,8 +58,8 @@ export default {
this.$router.push('/')
},
back: function() {
this.$router.push(this.$store.state.dictRoute)
this.$store.commit('setDictRoute', null)
this.$router.go(-1)
this.$store.commit('toggle', 'aboutOpen')
}
},
......
......@@ -94,7 +94,7 @@ const store = new Vuex.Store({
menuOpen: false,
searchRoute: null,
dictRoute: null,
aboutOpen: false
},
mutations: {
......@@ -137,9 +137,6 @@ const store = new Vuex.Store({
},
setSearchRoute(state, path) {
state.searchRoute = path
},
setDictRoute(state, path) {
state.dictRoute = path
}
}
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment