-
-
Save OliverJAsh/3a27766b54c038c808cb2a23e210c2a3 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 checkIsUploadingState = (state: State) => | |
state.tag === 'Uploading'; | |
const checkIsNewState = (a: State, b: State) => | |
a.tag === b.tag; | |
const epic: Epic<Action, Action, State> = ( | |
action$, | |
state$ | |
) => { | |
const stateEntry$ = state$.distinctUntilChanged( | |
checkIsNewState | |
); | |
const uploadingStateEntry$ = stateEntry$.filter( | |
checkIsUploadingState | |
); | |
const uploadRequest$ = uploadingStateEntry$.mergeMap( | |
upload | |
); | |
// … return actions based on request | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment