summaryrefslogtreecommitdiffstats
path: root/webapp/src/store/configurator.js
blob: 5624c41194e44b7c922d78d621b202e18b59e0fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import axios from 'axios'

export default {
  namespaced: true,
  state: {
    configs: [],
    entries: [],
    dialog: {
      show: false,
      type: null,
      info: {}
    }
  },
  mutations: {
    setConfigs (state, configs) { state.configs = configs },
    setEntries (state, entries) { state.entries = entries },
    setDialog (state, { show, type, info }) {
      if (info !== undefined) state.dialog.info = info
      if (type !== undefined) state.dialog.type = type
      if (show !== undefined) state.dialog.show = show
    }
  },
  actions: {
    loadData (context) {
      axios.get('/api/configurator/configs').then(result => {
        context.commit('setConfigs', result.data)
      })
      axios.get('/api/configurator/entries').then(result => {
        context.commit('setEntries', result.data)
      })
    }
  }
}