Skip to content

Instantly share code, notes, and snippets.

@liamzdenek
Created November 4, 2018 23:29
Show Gist options
  • Save liamzdenek/8a98760960eedc47e7a8cdf0f55dec4c to your computer and use it in GitHub Desktop.
Save liamzdenek/8a98760960eedc47e7a8cdf0f55dec4c to your computer and use it in GitHub Desktop.
Trigger an asynchronous action from an observable, and wait for it to complete before emitting another action.
function someEpic(action$, state$) {
return action$.ofType(SOME_BEGIN).pipe(
flatMap(begin => {
return merge(
of(actionCreatorForAsync()),
action$.ofType(ASYNC_END).pipe(
map(reduxRouterPush("/"))
)
)
})
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment