⚡ Language now managed in VueX store
This commit is contained in:
@@ -8,11 +8,12 @@ import filterUserSections from '@/utils/CheckSectionVisibility';
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
const { UPDATE_CONFIG, SET_MODAL_OPEN } = Keys;
|
||||
const { UPDATE_CONFIG, SET_MODAL_OPEN, SET_LANGUAGE } = Keys;
|
||||
|
||||
const store = new Vuex.Store({
|
||||
state: {
|
||||
config: {},
|
||||
lang: '', // The users language, auto-detected or read from local storage / config
|
||||
modalOpen: false, // KB shortcut functionality will be disabled when modal is open
|
||||
},
|
||||
getters: {
|
||||
@@ -39,11 +40,15 @@ const store = new Vuex.Store({
|
||||
[UPDATE_CONFIG](state, config) {
|
||||
state.config = config;
|
||||
},
|
||||
[SET_LANGUAGE](state, lang) {
|
||||
state.lang = lang;
|
||||
},
|
||||
[SET_MODAL_OPEN](state, modalOpen) {
|
||||
state.modalOpen = modalOpen;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
/* Called when app first loaded. Reads config and sets state */
|
||||
initializeConfig({ commit }) {
|
||||
const Accumulator = new ConfigAccumulator();
|
||||
const config = Accumulator.config();
|
||||
|
||||
Reference in New Issue
Block a user