Created
November 10, 2019 14:42
-
-
Save CharlieGreenman/575f535ede2700fb137ad9ceb9fb0a0c to your computer and use it in GitHub Desktop.
mergeMap effects example
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
@Effect() | |
loadAllBlogPosts$: Observable<any> = this.actions$.pipe( | |
ofType(PokemonActions.loadPokemon), | |
mergeMap(() => | |
this.postsService.getAll().pipe( | |
map(posts => PokemonActions.loadPokemonSuccess({ posts })), | |
catchError(message => of(PokemonActions.loadPostsFailed({ message }))) | |
) | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment