Last active
January 6, 2019 09:35
-
-
Save radzionc/9510d7155bc8554d48ddaa408ff5f240 to your computer and use it in GitHub Desktop.
sagas/index.js
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
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