import Vue from 'vue';
import Vuex from 'vuex';
import state from './state';
import mutations from './mutations';
import * as getters from './getters';


Vue.use(Vuex);

const files = require.context('./modules',false,/^\.\/(?!index)\w+\.js$/i);

let modules = {};
files.keys().forEach((key)=>{
  const k = key.match(/\w+/)[0];
  if(k){
    modules[k] = {
      ...files(key).default
    }
  }
})

export default new Vuex.Store({
  state,
  mutations,
  getters
})
