1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

Added setting.store

This commit is contained in:
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 store from '@/store';
import i18n from '@/i18n'; import i18n from '@/i18n';
i18n.locale = store.state.application.locale; i18n.locale = store.state.settings.locale;
Vue.config.productionTip = false; Vue.config.productionTip = false;
new Vue({ new Vue({

View File

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

View File

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