Created
June 13, 2017 07:39
-
-
Save tricoder42/b8e10ffd1431c6e2691569d6c5a8978d to your computer and use it in GitHub Desktop.
2017/06/13 [Medium] redux-saga factories and decorators
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
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