Skip to content
Snippets Groups Projects
Commit 01e5db02 authored by Jonathan Foucher's avatar Jonathan Foucher
Browse files

reload related data

parent b9e2ecbd
No related branches found
No related tags found
No related merge requests found
Pipeline #30653 failed
......@@ -29,11 +29,15 @@ export default {
})
return req
},
updateOrganization ({ commit }, item) {
updateOrganization ({ commit, dispatch }, item) {
const req = item.id ? axios.put(`/api/organizations/${item.id}`, item) : axios.post('/api/organizations', item)
req.then(res => {
commit('updateOrganization', res.data)
item.id ? toaster(this._vm, `La structure ${item.name} a été modifiée`, 'bg-success', 'check') : toaster(this._vm, `La structure ${item.name} a été créée`, 'bg-success', 'check')
//Update users
dispatch('getUsers')
//Update evaluations
dispatch('getEvaluations')
}).catch(err => {
console.log('could not update org', err)
commit('setErrors', { errors: err.response.data, status: err.response.status })
......@@ -47,6 +51,8 @@ export default {
commit('deleteOrganization', item)
// Refresh users to show that some have been deleted
dispatch('getUsers')
// Refresh evaluations to show that some have been deleted
dispatch('getEvaluations')
toaster(this._vm, `La structure ${item.name} a été supprimée`, 'bg-info', 'trash')
}).catch(err => {
console.log('could not delete org', err)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment