Ngrx pattern for dispatching action and checking if backend call was successful

177 views Asked by At

What is the correct way for dispatching an action which calls an endpoint to perform an update on backend?

Current suggestion is to have an action and an action_success and action_fail for each action. As an example if we want to edit a course, we will dispatch an action called course_update, in the effect for this action an endpoint is called, if the result of the backend is successful, we dispatch course_update_success and if not course_update_fail is dispatched.

This results in 3 action for each call. Is there a better way to do this?

0

There are 0 answers