Skip to content

Instantly share code, notes, and snippets.

@radzionc
Last active January 6, 2019 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radzionc/9510d7155bc8554d48ddaa408ff5f240 to your computer and use it in GitHub Desktop.
Save radzionc/9510d7155bc8554d48ddaa408ff5f240 to your computer and use it in GitHub Desktop.
sagas/index.js
import { takeLatest } from 'redux-saga/effects'
import * as loginActions from '../actions/login'
import * as loginSagas from './login'
import * as genericActions from '../actions/generic'
import * as genericSagas from './generic'
export default function* saga() {
const relations = [
[loginActions, loginSagas],
[genericActions, genericSagas],
]
for (const [actions, sagas] of relations) {
for (const [actionName, action] of Object.entries(actions)) {
const saga = sagas[actionName]
if (saga) yield takeLatest(action.getType(), saga)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment