Skip to content

Instantly share code, notes, and snippets.

@rubenmarcus
Created April 18, 2020 14:03
Show Gist options
  • Select an option

  • Save rubenmarcus/de2a5bd0ca3d500a28e1f334cdb47088 to your computer and use it in GitHub Desktop.

Select an option

Save rubenmarcus/de2a5bd0ca3d500a28e1f334cdb47088 to your computer and use it in GitHub Desktop.
const statusCheckEpic = action$ =>
action$.filter(action => action.type === POLL_SERVICE_STATUS)
.flatMap(() =>
most.fromPromise(checkServiceStatus())
.filter(response => response.data.status !== STATUS.IN_PROGRESS)
.map(response => {
if (response.data.status === STATUS.COMPLETE) {
return serviceComplete()
}
return serviceError()
})
.recoverWith(error => {
return most.of(serviceError(error))
})
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment