import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import user from './modules/user'
import inform from './modules/inform'
import createPersistedState from "vuex-persistedstate"
Vue.use(Vuex)

const store = new Vuex.Store({
    modules: {
        user,
        inform
    },
    getters,
    plugins: [createPersistedState({
        storage: window.sessionStorage,
        reducer(val) {
            // console.log(val);
            return { // 只储存state中的user 
                inform: val.inform,
                user: val.user
            }
        }
    })]
})


export default store
