UNPKG

ih-black-lion

Version:

State handler for Arus projects

17 lines (13 loc) 521 B
import { takeEvery, put, call } from 'redux-saga/effects'; import { REQUEST_PICTURE, RECEIVE_PICTURE } from '../actionTypes'; export function* fetchPicture(action) { try { const response = yield call(action.Api.getPicture, action.requestParams); yield put({ type: RECEIVE_PICTURE, response, status: 'success' }); } catch (error) { yield put({ type: RECEIVE_PICTURE, response: error, status: 'error' }); } } export default function* PictureSaga() { yield takeEvery(REQUEST_PICTURE, fetchPicture); }