import Vue from 'vue'
import Vuex from 'vuex'
import VuexPersistence from 'vuex-persist'
import common from './common'

// import example form './modules'
const vuexLocal = new VuexPersistence({
  key: 'WebBuilderTools',
  storage: window.localStorage,
  modules: ['common']
})

Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    common
  },
  plugins: [vuexLocal.plugin],

  // enable strict mode (adds overhead!)
  // for dev mode only
  strict: process.env.DEBUGGING
})
/*
 * If not building with SSR mode, you can
 * directly export the Store instantiation;
 *
 * The function below can be async too; either use
 * async/await or return a Promise which resolves
 * with the Store instance.
 */

export default store
