import Vue from 'vue'
import Vuex from 'vuex'
import permission from './permission'
Vue.use(Vuex)
const store = new Vuex.Store({
  state: sessionStorage.getItem('state')
    ? JSON.parse(sessionStorage.getItem('state'))
    : {
        routesPermission: [],
        currentRouterObj: {},
        loginReturnInformation: {},
        authRoutes: [],
        isCollapse: '',
        stepsActiveListData: [],
        stepsActiveListDataBarcode: []
      },
  mutations: {
    getRoutesPermission(state, val) {
      state.routesPermission = val
    },
    getCurrentRouterObj(state, val) {
      state.currentRouterObj = val
    },
    getLoginReturnInformation(state, val) {
      state.loginReturnInformation = val
    },
    getAuthRoutes(state, val) {
      state.authRoutes = val
    },
    getIsCollapse(state, val) {
      state.isCollapse = val
    },
    getStepsActiveListData(state, val) {
      state.stepsActiveListData = val
    },
    getStepsActiveListDataBarcode(state, val) {
      state.stepsActiveListDataBarcode = val
    }
  },
  actions: {},
  modules: {
    permission
  }
})
if (sessionStorage.getItem('state')) {
  sessionStorage.removeItem('state')
}
export default store
