update groups api routes

This commit is contained in:
axolotle 2021-03-22 18:41:42 +01:00
parent 06eb2165ea
commit 9657fc410e

View file

@ -227,11 +227,9 @@ export default {
}, },
onUserChanged ({ item, index, name, action }) { onUserChanged ({ item, index, name, action }) {
const uri = 'users/groups/' + name
const data = { [action]: item }
const from = action === 'add' ? 'availableMembers' : 'members' const from = action === 'add' ? 'availableMembers' : 'members'
const to = action === 'add' ? 'members' : 'availableMembers' const to = action === 'add' ? 'members' : 'availableMembers'
api.put(uri, data).then(() => { api.put(`users/groups/${name}/${action}/${item}`).then(() => {
this.normalGroups[name][from].splice(index, 1) this.normalGroups[name][from].splice(index, 1)
this.normalGroups[name][to].push(item) this.normalGroups[name][to].push(item)
}) })