Skip to content

Instantly share code, notes, and snippets.

@alexytiger
Last active September 23, 2019 03:08
Show Gist options
  • Save alexytiger/b8475ed2928ad4b72052d876269d56e9 to your computer and use it in GitHub Desktop.
Save alexytiger/b8475ed2928ad4b72052d876269d56e9 to your computer and use it in GitHub Desktop.
reload$ = createEffect(
() =>
this.actions$.pipe(
ofType(
PurchaseContractActions.abortSelectedPurchaseContractSuccess,
PurchaseContractActions.confirmBuySuccess,
PurchaseContractActions.confirmDeliverySuccess),
withLatestFrom(this.store$.pipe(select(fromStore.getSelectedPurchaseContract))),
tap(async ([action, contract]) => {
// here we trigger the the router's state change event
const randomKey = Math.random().toString(36).replace('0.', '');
await this.router.navigate(['/p2p-bazaar/products', randomKey]);
await this.router.navigate(['/p2p-bazaar/products', contract.productKey]);
})
),
{ dispatch: false }
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment