Skip to content

Instantly share code, notes, and snippets.

@alexytiger
Last active April 27, 2019 01:04
Show Gist options
  • Save alexytiger/a271fc959a49344ffea9ac7f71c68d38 to your computer and use it in GitHub Desktop.
Save alexytiger/a271fc959a49344ffea9ac7f71c68d38 to your computer and use it in GitHub Desktop.
import { Injectable } from '@angular/core';
import { Actions, ofType, createEffect } from '@ngrx/effects';
import { tap, map } from 'rxjs/operators';
import { ErrorActions } from '../actions';
@Injectable()
export class ErrorEffects {
constructor(private readonly actions$: Actions) {}
handleError$ = createEffect(
() =>
this.actions$.pipe(
ofType(ErrorActions.errorMessage),
map(action => action.errorMsg),
tap(errorMsg => console.error('Got error:', errorMsg))
),
{ dispatch: false }
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment