Added setting.store

This commit is contained in:
Fabio 2020-05-29 18:19:35 +02:00
parent d6a5239cb2
commit 5dc901a75c
4 changed files with 31 additions and 15 deletions

View File

@ -9,7 +9,7 @@ import App from '@/App.vue';
import store from '@/store';
import i18n from '@/i18n';
i18n.locale = store.state.application.locale;
i18n.locale = store.state.settings.locale;
Vue.config.productionTip = false;
new Vue({

View File

@ -5,6 +5,7 @@ import Vuex from 'vuex';
import VuexPersist from 'vuex-persist';
import application from './modules/application.store';
import settings from './modules/settings.store';
import connections from './modules/connections.store';
import workspaces from './modules/workspaces.store';
import notifications from './modules/notifications.store';
@ -13,7 +14,8 @@ const vuexLocalStorage = new VuexPersist({
key: 'application', // The key to store the state on in the storage provider.
storage: window.localStorage,
reducer: state => ({
connections: state.connections
connections: state.connections,
settings: state.settings
})
});
@ -23,6 +25,7 @@ export default new Vuex.Store({
strict: true,
modules: {
application,
settings,
connections,
workspaces,
notifications

View File

@ -1,34 +1,23 @@
'use strict';
import i18n from '@/i18n';
export default {
namespaced: true,
strict: true,
state: {
app_name: 'Antares - SQL Client',
is_loading: false,
locale: 'it-IT'
is_loading: false
},
getters: {
isLoading: state => state.is_loading,
appName: state => state.app_name,
getLocale: state => state.locale
appName: state => state.app_name
},
mutations: {
SET_LOADING_STATUS (state, payload) {
state.is_loading = payload;
},
SET_LOCALE (state, locale) {
state.locale = locale;
i18n.locale = locale;
}
},
actions: {
setLoadingStatus ({ commit }, payload) {
commit('SET_LOADING_STATUS', payload);
},
changeLocale ({ commit }, locale) {
commit('SET_LOCALE', locale);
}
}
};

View File

@ -0,0 +1,24 @@
'use strict';
import i18n from '@/i18n';
export default {
namespaced: true,
strict: true,
state: {
locale: 'it-IT'
},
getters: {
getLocale: state => state.locale
},
mutations: {
SET_LOCALE (state, locale) {
state.locale = locale;
i18n.locale = locale;
}
},
actions: {
changeLocale ({ commit }, locale) {
commit('SET_LOCALE', locale);
}
}
};