-
Notifications
You must be signed in to change notification settings - Fork 1
Description
The application has integrated a ToastrService
to display INFO/ERROR messages. We need to centralize the use of this service into a single place. Since HTML components are just dummy tags that render information populated in the MGRX store, we want to move all these notifications to the NGRX effects. In this way, we can immediately display an INFO/ERROR message after receiving a ..._SUCCESS or ...FAIL action type as follows:
@Effect()
deleteFailure$: Observable<Action> = this.actions$.pipe(
ofType(actions.EntryActionTypes.DELETE_FAIL),
map(() => {
this.toastrService.error('An unexpected error happen, please try again later');
})
);
In the case of errors please display a generic error message:
An unexpected error happen, please try again later
Consider using error messages from the backend, if those are business errors. In case of successful operations please use
this.toastrService.success
With a message pretty generic like,
The information has been saved successfully.
Consider replacing any message for a better one if that is necessary.