/**
 * vuex状态管理
 */
import Vue from 'vue';
import Vuex from 'vuex';
import getters from './getters';
import dict from './modules/dict';
import user from './modules/user';
import concact from './modules/concact'
import order from './modules/order'
import returnGoods from './modules/returnGoods'
import selectCache from './modules/selectCache';
import theme from './modules/theme';
import createPersistedState from 'vuex-persistedstate';

import { SYSTEM_NAME } from '@/config/setting';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    
  },
  mutations: {
   
  },
  actions: {},
  modules: {
    dict,
    user,
    concact,
    returnGoods,
    order,
    selectCache,
    theme
  },
  getters,
  plugins: [
    //会自动保存创建的状态。刷新还在
    createPersistedState({
      key: window.__POWERED_BY_QIANKUN__
        ? `vuex-${SYSTEM_NAME}`
        : `private-vuex-${SYSTEM_NAME}`,
      storage: window.sessionStorage,
      paths: ['user']
    })
  ]
});
