Skip to content

Instantly share code, notes, and snippets.

@alexytiger
Last active September 10, 2019 03:32
Show Gist options
  • Save alexytiger/48237b6afbfc94efafdf7e64eb6cec7f to your computer and use it in GitHub Desktop.
Save alexytiger/48237b6afbfc94efafdf7e64eb6cec7f to your computer and use it in GitHub Desktop.
loadProducts$ = createEffect(() =>
this.actions$.pipe(
ofType(PurchaseContractActions.loadProducts),
switchMap(() =>
this.fleaSrv.getPurchaseContractList().pipe(
tap(products => console.log('purchase contracts:', products)),
map(products => PurchaseContractActions.loadProductsSuccess({ products })),
catchError((err: Error) =>
of(ErrorActions.errorMessage({ errorMsg: err.message }),
SpinnerActions.hide())
)
)
)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment