summaryrefslogtreecommitdiffstats
path: root/webapp/src/store
diff options
context:
space:
mode:
authorUdo Walter2018-08-04 10:18:59 +0200
committerUdo Walter2018-08-04 10:18:59 +0200
commit132e04e3f71a101f69309b4c9c8b8ed5618b111b (patch)
tree933679f9cdba76fdfccb9c4b5d441fcd29200ea0 /webapp/src/store
parentsmall changes (diff)
downloadbas-132e04e3f71a101f69309b4c9c8b8ed5618b111b.tar.gz
bas-132e04e3f71a101f69309b4c9c8b8ed5618b111b.tar.xz
bas-132e04e3f71a101f69309b4c9c8b8ed5618b111b.zip
[groups] small bug fixes
Diffstat (limited to 'webapp/src/store')
-rw-r--r--webapp/src/store/groups.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/webapp/src/store/groups.js b/webapp/src/store/groups.js
index e595232..ddb1df8 100644
--- a/webapp/src/store/groups.js
+++ b/webapp/src/store/groups.js
@@ -33,8 +33,8 @@ export default {
actions: {
loadLists (context) {
Promise.all([axios.get('/api/groups/getList'), axios.get('/api/clients/getList')]).then(res => {
- context.commit('setGroupList', res[0].data)
- context.commit('setClientList', res[1].data)
+ context.commit('setGroupList', res[0].data.map(x => ({ id: x.id, name: x.name || x.id })))
+ context.commit('setClientList', res[1].data.map(x => ({ id: x.id, name: x.name || x.id })))
})
},
loadHome (context) {
@@ -74,8 +74,9 @@ export default {
else if (item.tabType === 'client') context.dispatch('loadClient', { id: item.id, tabIndex: index, reload: true })
})
},
- saveGroup (context, { id, info, parentIds, tabIndex }) {
+ saveGroup (context, { id, info, parentIds, tabIndex, callback }) {
axios.post('/api/groups/save', { id, info, parentIds }).then(res => {
+ if (callback) callback(res.data.id)
if (!id) context.commit('setTab', { index: tabIndex, item: { id: res.data.id, name: info.name, tabType: 'group' } })
if (parentIds && tabIndex > 1 && !parentIds.includes(context.state.tabChain[tabIndex - 1].id)) {
context.commit('deleteFromTabChain', { index: 1, count: tabIndex - 1 })
@@ -84,8 +85,9 @@ export default {
context.dispatch('reload')
})
},
- saveClient (context, { id, info, groupIds, tabIndex }) {
+ saveClient (context, { id, info, groupIds, tabIndex, callback }) {
axios.post('/api/clients/save', { id, info, groupIds }).then(res => {
+ if (callback) callback(res.data.id)
if (!id) context.commit('setTab', { index: tabIndex, item: { id: res.data.id, name: info.name, tabType: 'client' } })
if (groupIds && tabIndex > 1 && !groupIds.includes(context.state.tabChain[tabIndex - 1].id)) {
context.commit('deleteFromTabChain', { index: 1, count: tabIndex - 1 })