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

revert migration to vuex

parent 5ca08b3b
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,8 @@
:dense="$vuetify.breakpoint.mobile"
>
<template v-slot:append>
<a class="accessibility_link" href="#title_0">Gå videre til hovedinnholdet</a>
<a v-if="$parent.search_results.bm" href="#result0" class="accessibility_link" tabindex="0">Gå videre til treff i Bokmålsordboka</a>
<a v-if="$parent.search_results.nn" :href="'#result'+!$parent.search_results.bm?'0':$parent.search_results.bm.length" class="accessibility_link" tabindex="0">Gå videre til treff i Nynorskordboka</a>
<a href="#top_menu" class="accessibility_link"
@click="$store.commit('toggle', 'menuOpen')"
......
......@@ -256,8 +256,12 @@ export default {
data: function() {
return {
article_key: 0,
search_results: {},
lang: this.$store.state.defaultDict,
waiting_for_articles: true,
waiting_for_metadata: true,
article: null,
error: null,
monthly_bm: null,
monthly_nn: null,
event: null,
......@@ -277,22 +281,6 @@ export default {
},
get_search_endpoint: function() {
return api
},
search_results: {
get() { return this.$store.state.search_results },
set(value) { this.$store.commit('setState', {name: 'search_results', value})}
},
lang: {
get() { return this.$store.state.lang },
set(value) { this.$store.commit('setState', {name: 'lang', value})}
},
article: {
get() { return this.$store.state.article },
set(value) { this.$store.commit('setState', {name: 'article', value})}
},
error: {
get() { return this.$store.state.error },
set(value) { this.$store.commit('setState', {name: 'error', value})}
}
},
components: {
......
......@@ -93,20 +93,6 @@ const store = new Vuex.Store({
currentLocale: null,
collapseArticles: null,
menuOpen: false,
search_results: {},
lang: null,
article: null,
error: null,
scope: null,
pos_selected: null,
article_info: null,
page: null,
perPage: null,
selected: null,
inflection_suggestions: null
},
mutations: {
initStore(state) {
......@@ -126,13 +112,6 @@ const store = new Vuex.Store({
}
},
initRouteVariables(state) {
state.lang = router.history.current.params.lang || localStorage.getItem('defaultDict') || 'bm,nn'
state.scope = router.history.current.query.scope
state.pos_selected = router.history.current.query.pos ? router.history.current.query.pos.toUpperCase() : null
state.page = router.history.current.query.page? parseInt(router.history.current.query.page) : null
state.perPage = router.history.current.query.perPage? parseInt(router.history.current.query.perPage) : null
},
setLocale(state, payload) {
state.currentLocale = payload.value
payload.i18n.locale = payload.value
......@@ -153,26 +132,7 @@ const store = new Vuex.Store({
localStorage.removeItem("currentLocale")
localStorage.removeItem("collapseArticles")
this.commit("initStore")
},
updateHistory(state) {
history.replaceState({article: state.article,
search_results: state.search_results,
lang: state.lang,
error: state.error,
event: state.event,
pos_selected: state.pos_selected,
scope: state.scope,
article_info: state.article_info,
page: state.page,
perPage: state.perPage,
selected: state.selected,
inflection_suggestions: state.inflection_suggestions}, '')
},
setState(state, payload) {
console.log("PAYLOAD", payload)
state[payload.name] = payload.value
}
}
})
......
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