@controlla/cli
Version:
Command line interface for rapid Controlla projects development
47 lines (40 loc) • 882 B
JavaScript
import Vue from 'vue'
import Vuex from 'vuex'
import VueLocalStorage from 'vue-localstorage'
// import Case from 'case'
import app from '../../main' // import the instance
Vue.use(Vuex)
Vue.use(VueLocalStorage)
const state = {
appName: 'App',
backUrl: '',
language: Vue.localStorage.get('language', 'es')
}
const mutations = {
SET_LANGUAGE (state, payload) {
state.language = payload
app.$i18n.locale = payload
app.$localStorage.set('language', payload)
},
SET_BACK_URL (state, payload) {
state.backUrl = payload
}
}
const actions = {
setLanguage ({ commit }, payload) {
commit('SET_LANGUAGE', payload)
},
setBackUrl ({ commit }, payload) {
commit('SET_BACK_URL', payload)
}
}
const getters = {
backUrl: state => state.backUrl,
language: state => state.language
}
export default {
state,
mutations,
actions,
getters
}