Created
January 13, 2019 14:28
-
-
Save BiosBoy/f49acae8039490ba262d5d97fb39975e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { put } from 'redux-saga/effects'; | |
| import { someAsyncAction } from '../actions'; | |
| export function* someSaga() { | |
| try { | |
| const payload = yield fetch('https://www.github.com'); | |
| // throw an error if no payload received | |
| if (!payload) { | |
| throw new Error('Error in payload!'); | |
| } | |
| // some payload from the responce received | |
| yield put(someAsyncAction(payload)); | |
| } catch (error) { | |
| throw new Error('Some error in sagas occured!'); | |
| } | |
| } | |
| export default someSaga; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment