summaryrefslogtreecommitdiffstats
path: root/webapp/src/store/registration.js
blob: e7fb6cb4e0b34b7522c6362ec89a5fd604fa2dab (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
34
import axios from 'axios'

export default {
  namespaced: true,
  state: {
    hooks: [],
    dialog: {
      show: false,
      type: null,
      info: {}
    }
  },
  mutations: {
    setHooks (state, hooks) { state.hooks = hooks },
    setGroupList (state, groupList) { state.groupList = groupList },
    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: {
    loadHooks (context) {
      axios.get('/api/registration/hooks').then(result => {
        context.commit('setHooks', result.data)
      })
    },
    setHooks (context, hooks) {
      axios.post('/api/registration/hookorder', { ids: hooks.map(x => x.id) }).then(result => {
        context.commit('setHooks', hooks)
      })
    }
  }
}