Created
April 18, 2020 14:03
-
-
Save rubenmarcus/de2a5bd0ca3d500a28e1f334cdb47088 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
| 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