Skip to content

Instantly share code, notes, and snippets.

@NikolayGalkin
Created April 4, 2017 12:55
Show Gist options
  • Save NikolayGalkin/4de2756cbb16bfba90f8a7d7a2c288e0 to your computer and use it in GitHub Desktop.
Save NikolayGalkin/4de2756cbb16bfba90f8a7d7a2c288e0 to your computer and use it in GitHub Desktop.
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