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

Vue.use(Vuex);

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

// modules
import { card, free } from "./modules/card/store";
import exam from "./modules/exam/store";
import baseConfigs from "./modules/analysis/components/baseConfig/baseConfigsStore";
import markParam from "./modules/mark/components/markParam/store";
import report from "./modules/mark/components/report/store";

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