Refetch builder data
This commit is contained in:
parent
703e2c1873
commit
1081d415fa
|
@ -104,19 +104,8 @@ const automationActions = store => ({
|
||||||
},
|
},
|
||||||
save: async automation => {
|
save: async automation => {
|
||||||
const response = await API.updateAutomation(automation)
|
const response = await API.updateAutomation(automation)
|
||||||
store.update(state => {
|
|
||||||
const updatedAutomation = response.automation
|
await store.actions.fetch()
|
||||||
const existingIdx = state.automations.findIndex(
|
|
||||||
existing => existing._id === automation._id
|
|
||||||
)
|
|
||||||
if (existingIdx !== -1) {
|
|
||||||
state.automations.splice(existingIdx, 1, updatedAutomation)
|
|
||||||
return state
|
|
||||||
} else {
|
|
||||||
state.automations = [...state.automations, updatedAutomation]
|
|
||||||
}
|
|
||||||
return state
|
|
||||||
})
|
|
||||||
return response.automation
|
return response.automation
|
||||||
},
|
},
|
||||||
delete: async automation => {
|
delete: async automation => {
|
||||||
|
|
Loading…
Reference in New Issue