From 5a15373dcd76ed7371dbbee88104dd0c4384a889 Mon Sep 17 00:00:00 2001 From: Udo Walter Date: Mon, 12 Nov 2018 04:59:16 +0000 Subject: [registration] add configurator for registration hooks --- webapp/src/store/registration.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 webapp/src/store/registration.js (limited to 'webapp/src/store') diff --git a/webapp/src/store/registration.js b/webapp/src/store/registration.js new file mode 100644 index 0000000..388558d --- /dev/null +++ b/webapp/src/store/registration.js @@ -0,0 +1,40 @@ +import axios from 'axios' + +export default { + namespaced: true, + state: { + hooks: [], + groupList: [], + 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/registrations/hooks').then(result => { + context.commit('setHooks', result.data) + }) + }, + loadGroupList (context) { + axios.get('/api/groups/getList').then(result => { + context.commit('setGroupList', result.data) + }) + }, + setHooks (context, hooks) { + axios.post('/api/registrations/hookorder', { ids: hooks.map(x => x.id) }).then(result => { + context.commit('setHooks', hooks) + }) + } + } +} -- cgit v1.2.3-55-g7522