summaryrefslogtreecommitdiffstats
path: root/webapp/src/store/groups.js
diff options
context:
space:
mode:
authorUdo Walter2018-11-26 20:12:31 +0100
committerUdo Walter2018-11-26 20:12:31 +0100
commit82648439b945cc5d049886f7e79c2f0dd9d14ff9 (patch)
treeebeb33ba47bef73306d004b230726ddad5d16bfa /webapp/src/store/groups.js
parent[webapp] small bugfix (diff)
downloadbas-82648439b945cc5d049886f7e79c2f0dd9d14ff9.tar.gz
bas-82648439b945cc5d049886f7e79c2f0dd9d14ff9.tar.xz
bas-82648439b945cc5d049886f7e79c2f0dd9d14ff9.zip
[webapp+server] Add first implementation of a websocket to alert webclients of events
and to synchronize notification across multiple webapp instances of the same user
Diffstat (limited to 'webapp/src/store/groups.js')
-rw-r--r--webapp/src/store/groups.js18
1 files changed, 12 insertions, 6 deletions
diff --git a/webapp/src/store/groups.js b/webapp/src/store/groups.js
index 1bbded9..adc78f8 100644
--- a/webapp/src/store/groups.js
+++ b/webapp/src/store/groups.js
@@ -130,7 +130,7 @@ export default {
}
})
},
- deleteGroups (context, { selected }) {
+ deleteGroups (context, { selected, callback }) {
const ids = selected.map(x => x.id)
axios.post('/api/groups/delete', { ids }).then(() => {
var i = 1
@@ -142,18 +142,20 @@ export default {
i++
}
context.dispatch('reload')
+ if (callback) callback()
})
},
- deleteClients (context, { selected }) {
+ deleteClients (context, { selected, callback }) {
const ids = selected.map(x => x.id)
axios.post('/api/clients/delete', { ids }).then(() => {
const index = context.state.tabChain.length - 1
const item = context.state.tabChain[index]
if (item.tabType === 'client' && ids.includes(item.id)) context.commit('deleteFromTabChain', { index, count: 1 })
context.dispatch('reload')
+ if (callback) callback()
})
},
- removeSubroups (context, { tabIndex, selected }) {
+ removeSubroups (context, { tabIndex, selected,callback }) {
const id = context.state.tabChain[tabIndex].id
const ids = selected.map(x => x.id)
axios.post('/api/groups/removeSubgroups', { id, ids }).then(() => {
@@ -163,9 +165,10 @@ export default {
context.commit('deleteFromTabChain', { index: tabIndex + 1, count: context.state.tabChain.length - (tabIndex + 1) })
}
context.dispatch('reload')
+ if (callback) callback()
})
},
- removeClients (context, { tabIndex, selected }) {
+ removeClients (context, { tabIndex, selected, callback }) {
const id = context.state.tabChain[tabIndex].id
const ids = selected.map(x => x.id)
axios.post('/api/groups/removeClients', { id, ids }).then(() => {
@@ -175,20 +178,23 @@ export default {
context.commit('deleteFromTabChain', { index: tabIndex + 1, count: 1 })
}
context.dispatch('reload')
+ if (callback) callback()
})
},
- addSubgroups (context, { tabIndex, selected }) {
+ addSubgroups (context, { tabIndex, selected, callback }) {
const id = context.state.tabChain[tabIndex].id
const ids = selected.map(x => x.id)
axios.post('/api/groups/addSubgroups', { id, ids }).then(() => {
context.dispatch('reload')
+ if (callback) callback()
})
},
- addClients (context, { tabIndex, selected }) {
+ addClients (context, { tabIndex, selected, callback }) {
const id = context.state.tabChain[tabIndex].id
const ids = selected.map(x => x.id)
axios.post('/api/groups/addClients', { id, ids }).then(() => {
context.dispatch('reload')
+ if (callback) callback()
})
}
}