Skip to content

Instantly share code, notes, and snippets.

@alexytiger
Created July 20, 2019 13:02
Show Gist options
  • Save alexytiger/4987cb5efe89ae4b4a03e6b4ac45bdce to your computer and use it in GitHub Desktop.
Save alexytiger/4987cb5efe89ae4b4a03e6b4ac45bdce to your computer and use it in GitHub Desktop.
addProduct$ = createEffect(() =>
this.actions$.pipe(
ofType(PurchaseContractActions.createPurchaseContractSuccess),
switchMap((payload) => {
return this.productSrv.loadPurchaseContract(payload.address).pipe(
tap(product => console.log('purchase contract:', product)),
map(product => PurchaseContractActions.addProduct({product})),
catchError((err: Error) =>
of(ErrorActions.errorMessage({ errorMsg: err.message }))
)
);
})
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment