Last active
December 11, 2016 00:28
-
-
Save griffinmichl/23eccd2e1f2e17e9dd301dc51036a506 to your computer and use it in GitHub Desktop.
This file contains 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 removeCreativeEpic = (action$) => | |
action$.ofType('REMOVE_CREATIVE') | |
.groupBy(action => action.payload.campaignId) | |
.mergeMap( | |
groupedAction$ => groupedAction$ | |
.concatMap(action => makeAjax(action) | |
.map(response => ({ | |
type: 'REMOVE_CREATIVE_SUCCESS', | |
payload: response, | |
}) | |
.catch(error => ({ | |
type: 'REMOVE_CREATIVE_ERROR', | |
payload: error, | |
}) | |
.takeUntil( | |
action$.ofType('REMOVE_CREATIVE_CANCELLED') | |
.filter(newAction => | |
newAction.payload.campaignId !== action.payload.campaignId | |
) | |
) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment