Last active
September 2, 2019 15:39
-
-
Save alexytiger/f2c83acaadaa9b388cd0e43a319f28aa to your computer and use it in GitHub Desktop.
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(ErrorActions.errorMessage({ errorMsg: err.message }), SpinnerActions.hide(), | |
| // update ballance | |
| Web3ProviderActions.getBalance()) | |
| ) | |
| ) | |
| }) | |
| )); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment