Created
September 5, 2017 22:11
-
-
Save Calvin-Huang/26234eb7202c795c3c6335d0cf0487ba 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 { call, put } from 'redux-saga/effects' | |
export function* fetchData(action) { | |
try { | |
const data = yield call(Api.fetchUser, action.payload.url) | |
yield put({type: "FETCH_SUCCEEDED", data}) | |
} catch (error) { | |
yield put({type: "FETCH_FAILED", error}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment