import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

// TODO:待完善
const privilegeMapData = window.sessionStorage.getItem("privilegeMap");
const privilegeMap = privilegeMapData ? JSON.parse(privilegeMapData).value : {};

// modules
import exam from "./modules/exam/store";
import baseConfigs from "./modules/analysis/components/baseConfig/baseConfigsStore";

export default new Vuex.Store({
  state: {
    user: {},
    privilegeMap,
    shortupMenus: []
  },
  mutations: {
    setUser(state, user) {
      state.user = user;
    },
    setPrivilegeMap(state, privilegeMap) {
      state.privilegeMap = privilegeMap;
    }
  },
  actions: {},
  modules: {
    exam,
    baseConfigs
  }
});
