Skip to content

Instantly share code, notes, and snippets.

@tricoder42
Created June 13, 2017 07:39
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 tricoder42/b8e10ffd1431c6e2691569d6c5a8978d to your computer and use it in GitHub Desktop.
Save tricoder42/b8e10ffd1431c6e2691569d6c5a8978d to your computer and use it in GitHub Desktop.
2017/06/13 [Medium] redux-saga factories and decorators
export const fetchSaga = (entity, api) => function* ({ payload }) {
try {
const data = yield call(api, payload)
yield put(entity.response(data))
}
catch(error) {
yield put(entity.response(error))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment