Skip to content

Instantly share code, notes, and snippets.

@alexytiger
Last active January 18, 2020 04:59
Show Gist options
  • Save alexytiger/723e51931c9604ba03374d922c0cee31 to your computer and use it in GitHub Desktop.
Save alexytiger/723e51931c9604ba03374d922c0cee31 to your computer and use it in GitHub Desktop.
e-book
createProduct$ = createEffect(
() =>
this.actions$.pipe(
ofType(PurchaseContractActions.createPurchaseContract),
map(action => action.payload),
exhaustMap((payload) => {
return this.fleaSrv.createPurchaseContract(payload).pipe(
tap(address => console.log('Contract address: ', address)),
switchMap((address: string) => {
return [
PurchaseContractActions.createPurchaseContractSuccess({
product: {
productKey: payload.productKey,
contractAddress: address
}
}),
// update ballance
Web3ProviderActions.getBalance()];
}),
catchError((err: Error) =>
of(this.handleError(err), SpinnerActions.hide(), Web3ProviderActions.getBalance())
)
);
})
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment