I'm trying to handle an action which depends on the result of another action.
I have a form component to CREATE/UPDATE 2 entities :
- Submit form
- First call APIAction.save and save "parentEntityData"
- Second call APIAction.save and save "childEntityData" with the "parentEntityData" id received from server.
Does it make sense to add a callback to action payload ?
APIAction.save({
entity: 'parentEntity',
model: parentModel,
next: (parentEntityId) => {
APIAction.save({
entity: 'childEntity',
model: childModel.set('parentId', parentEntityId)
})
}
})