Last active
May 25, 2017 01:00
-
-
Save aminmarashi/b484f890695658867d44a62dde621d45 to your computer and use it in GitHub Desktop.
non-standard takeEvery that passes payload instead of action to the saga
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
import { fork, takeEvery } from 'redux-saga/effects'; | |
function* intermediateGen(saga, ...args) { | |
yield fork(saga, ...args.slice(0, -1), args.slice(-1)[0].payload); | |
} | |
export default function customTakeEvery(pattern, saga, ...args) { | |
return takeEvery(pattern, intermediateGen, saga, ...args); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment