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:
@ -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({
|
||||||
|
@ -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
|
||||||
|
@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
Reference in New Issue
Block a user