import Vue from 'vue'
import Vuex from 'vuex'
import login from '@/store/login.js'
import menu from '@/store/menu.js'
import storeProcess from '@/store/storeProcess.js'
import user from '@/store/user.js'
import oftenFlow from '@/store/oftenFlow.js'
import mail from '@/store/mail.js'
import approvalItem from '@/store/approvalItemList.js'
import messageReceiver from '@/store/messageReceiverList.js'
import agent from '@/store/agentList.js'
import deputy from '@/store/bpmDeputy.js'
import form from '@/store/formStore.js'
import relatedProcess from '@/store/relatedProcess.js'
import dialog from '@/store/dialogStore.js'
import index from '@/store/index.js'
import patrolRescueIncidents from "@/store/rescueIncidents.js"
import reportFilling from '@/store/reportFilling.js'
import websocket from '@/store/websocket'
import createPersistedState from 'vuex-persistedstate'

Vue.use(Vuex)

const debug = process.env.NODE_ENV !== 'production'

export default new Vuex.Store({
  modules: {
    login,
    menu,
    storeProcess,
    user,
    oftenFlow,
    mail,
    approvalItem,
    messageReceiver,
    agent,
    deputy,
    form,
    relatedProcess,
    dialog,
    index,
    patrolRescueIncidents,
    reportFilling,
    websocket,

  },
  strict: debug,
  plugins: [
    createPersistedState({
      // 存储方式：localStorage、sessionStorage、cookies  默认: localStorage
      storage: window.sessionStorage,
      // 存储的 key 的key值
      key: 'persistedState',
      // 存储模块
      paths: ['user']
    })
  ]
})
