import Vue from 'vue'
import Vuex from 'vuex'
import preState from 'vuex-persistedstate'
import * as modules from "dvcp-ui/lib/js/modules"
import axios from "../router/axios";

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    apps: []
  },
  mutations: {
    addApp(state, app) {
      state.apps.push(app)
    },
    cleanApps(state) {
      state.apps = []
    },
    setFinanceUser(state) {
      axios.post("appfinancialorganizationuser/checkUser").then(res => {
        state.user.financeUser = res.data
      }).catch(() => 0)
    }
  },
  modules,
  plugins: [preState()]
})
