Last active
January 18, 2020 04:59
-
-
Save alexytiger/723e51931c9604ba03374d922c0cee31 to your computer and use it in GitHub Desktop.
e-book
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
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