Last active
April 27, 2019 01:04
-
-
Save alexytiger/a271fc959a49344ffea9ac7f71c68d38 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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