Is it a valid approach to get an action result, and if so, how can this be achieved?
For instance, if there is a page with a form for creating entities, after successfully creating an entity, the user should be redirected to the entity's detail view. On failure, error messages should be displayed without mixing up application layers (e.g. avoiding redirection in epic/effect after success).
Several approaches to solving this problem come to mind:
(observable pattern) Trigger an "entity_add" action, then dispatch a success ("entity_add_success") or failure ("entity_add_failure") action somewhere in the epic/effect. Wait for the failure or success action and take appropriate action - one drawback of this approach is that other entities may be created concurrently, making it challenging to distinguish between the failure/success actions.
(callback pattern) Dispatch a trigger action with an additional callback parameter to be called when the action result is determined. This approach also has a drawback: the potential for callback hell.
(service pattern) If using Flux becomes too complicated, consider bypassing it and using services directly. The downside of this design choice is mixing application layers.
Any ideas on how to tackle this issue would be greatly appreciated.