Created
April 4, 2017 12:55
-
-
Save NikolayGalkin/4de2756cbb16bfba90f8a7d7a2c288e0 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
import { fork, call, put, takeEvery } from 'redux-saga/effects'; | |
import { getRecentRecipes } from '../services/api'; | |
function* fetchRecentRecipes(featherApp) { | |
const recipes = yield call(getRecentRecipes, featherApp); | |
yield put({ type: 'RECENT_RECIPES_SUCCEEDED', recipes }); | |
} | |
function* recentRecipesSaga(featherApp) { | |
yield takeEvery('RECENT_RECIPES_REQUESTED', fetchRecentRecipes, featherApp); | |
} | |
export default function* root(featherApp) { | |
yield [ | |
fork(recentRecipesSaga, featherApp) | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment