Blame view

api/dashboard/src/store/index.js 508 Bytes
0d8c0f816   Thanasis Naskos   initial commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  import Vue from 'vue'
  import Vuex from 'vuex'
  
  Vue.use(Vuex)
  
  // Load store modules dynamically.
  const requireContext = require.context('./modules', false, /.*\.js$/)
  
  const modules = requireContext.keys()
    .map(file =>
      [file.replace(/(^.\/)|(\.js$)/g, ''), requireContext(file)]
    )
    .reduce((modules, [name, module]) => {
      if (module.namespaced === undefined) {
        module.namespaced = true
      }
  
      return { ...modules, [name]: module }
    }, {})
  
  export default new Vuex.Store({
    modules
  })