Created
December 6, 2018 03:39
-
-
Save alex-okrushko/ea1a8784b7d48b5f52050ad6b6d5e00c to your computer and use it in GitHub Desktop.
most basic API call
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() | |
fetchProducts: Observable<Action> = this.actions$.pipe( | |
ofType<actions.FetchProducts>(actions.FETCH_PRODUCTS), | |
switchMap(() => | |
this.productService.getProducts().pipe( | |
map(products => new actions.FetchProductsSuccess(products)), | |
catchError(() => of(new actions.FetchProductsError())) | |
) | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment