Skip to content

Move notification messages to ngrx effects #237

@enriquezrene

Description

@enriquezrene

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions