parent
791ec7ae24
commit
40df1f1202
@ -1,25 +1,16 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
// import from 'electron-settings'
|
||||
import createPersistedState from 'vuex-persistedstate'
|
||||
// import the auto exporter
|
||||
import createLogger from 'vuex/dist/logger'
|
||||
import modules from './modules'
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
const debug = process.env.NODE_ENV !== 'production'
|
||||
|
||||
export default new Vuex.Store({
|
||||
state: {
|
||||
settings: { flightgearDirectory: '.' }
|
||||
},
|
||||
actions: {
|
||||
},
|
||||
mutations: {
|
||||
'DELETE_INDEXED_DB' () {},
|
||||
'SETTINGS_DIRECTORY' (state, flightgearDirectory) {
|
||||
state.settings.flightgearDirectory = flightgearDirectory
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
hydrated: state => state.hydrated
|
||||
},
|
||||
plugins: [createPersistedState()],
|
||||
strict: true
|
||||
modules,
|
||||
strict: debug,
|
||||
plugins: debug ? [createLogger()] : [] // set logger only for development
|
||||
})
|
||||
|
@ -1,25 +1,24 @@
|
||||
import createPersistedState from 'vuex-persistedstate'
|
||||
|
||||
const state = {
|
||||
flightgearPath: ''
|
||||
settings: { flightgearDirectory: '.' }
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
DECREMENT_MAIN_COUNTER (state) {
|
||||
state.main--
|
||||
},
|
||||
INCREMENT_MAIN_COUNTER (state) {
|
||||
state.main++
|
||||
'DELETE_INDEXED_DB' () { },
|
||||
'SETTINGS_DIRECTORY' (state, flightgearDirectory) {
|
||||
state.settings.flightgearDirectory = flightgearDirectory
|
||||
}
|
||||
}
|
||||
|
||||
const plugins = [createPersistedState()]
|
||||
|
||||
const actions = {
|
||||
someAsyncTask ({ commit }) {
|
||||
// do something async
|
||||
commit('INCREMENT_MAIN_COUNTER')
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
actions,
|
||||
plugins
|
||||
}
|
||||
|
Loading…
Reference in new issue