Newer
Older
import About from './components/About.vue'
import DictionaryView from './components/DictionaryView.vue'
import vuetify from './plugins/vuetify'
Vue.use(VuePlausible, {
domain: 'beta.ordbok.uib.no'
})
Vue.$plausible.enableAutoPageviews()
const store = new Vuex.Store({
strict: true,
state: {
showSearchToolbar: null,
showHGNO: null,
showInflectionNo: null,
currentLocale: null
},
mutations: {
initStore(state) {
state.showSearchToolbar = localStorage.getItem('showSearchToolbar') || false
state.showHGNO = localStorage.getItem('showHGNO') || false
state.showInflectionNo = localStorage.getItem('showInflectionNo') || false
state.currentLocale = localStorage.getItem('currentLocale') || {text:"nob", value: "nob"}
resetStore(state) {
localStorage.removeItem("showSearchToolbar")
localStorage.removeItem("showHGNO")
localStorage.removeItem("showInflectionNo")
localStorage.removeItem("currentLocale")
this.commit("initStore", state)
},
changeLocale(state, locale) {
state.currentLocale = locale
toggle(state, setting) {
let value = !state[setting]
state[setting] = value
localStorage.setItem(setting, value);
const router = new VueRouter({
mode: 'history',
base: __dirname,
routes: [
{
children: [
{
path: 'om',
name: 'about',
component: About
},
{
path: '',
component: DictionaryView,
children: [
{
},
{
name: 'lookup',
path: ':id(\\d+)/:lemma?'
},
{
name: 'search',
{
path: 'bob/*',
redirect: to => {
return "bm/" + to.params.pathMatch
}
},
{
path: 'nob/*',
redirect: to => {
console.log(to)
return "nn/" + to.params.pathMatch
}
},
{
path: 'bob,nob/*',
redirect: to => {
return "bm,nn/" + to.params.pathMatch
}