mirror of
https://github.com/Fabio286/antares.git
synced 2024-12-22 14:24:04 +01:00
Added setting.store
This commit is contained in:
parent
d6a5239cb2
commit
5dc901a75c
@ -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({
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
24
src/renderer/store/modules/settings.store.js
Normal file
24
src/renderer/store/modules/settings.store.js
Normal 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);
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user