Skip to content

Instantly share code, notes, and snippets.

@Calvin-Huang
Created September 5, 2017 22:11
Show Gist options
  • Save Calvin-Huang/26234eb7202c795c3c6335d0cf0487ba to your computer and use it in GitHub Desktop.
Save Calvin-Huang/26234eb7202c795c3c6335d0cf0487ba to your computer and use it in GitHub Desktop.
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