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

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    tree: JSON.parse(localStorage.getItem("tree")),
    type: "",
    currentComponent: "",
    user_id: "USER202307301114011710",
  },
  mutations: {
    setTree(state, a) {
      state.tree = a;
      localStorage.setItem("tree", JSON.stringify(a));
    },
    setType(state, a) {
      state.type = a;
    },
    changeComPonent(state, a) {
      state.currentComponent = a;
    },
    saveUserID(state, a) {
      state.user_id = a;
    }
  },
  actions: {},
});
