UNPKG

ih-black-lion

Version:

State handler for Arus projects

16 lines (13 loc) 528 B
import { takeEvery, put, call } from 'redux-saga/effects'; import { REQUEST_SUBJECTS, RECEIVE_SUBJECTS } from '../actionTypes'; export function* fetchSubjects(action) { try { const response = yield call(action.Api.getSubjects, action.requestParams); yield put({ type: RECEIVE_SUBJECTS, response, status: 'success' }); } catch (error) { yield put({ type: RECEIVE_SUBJECTS, response: error, status: 'error' }); } } export default function* SubjectSaga() { yield takeEvery(REQUEST_SUBJECTS, fetchSubjects); }