ih-black-lion
Version:
State handler for Arus projects
22 lines (19 loc) • 654 B
JavaScript
import { takeEvery, put, call } from 'redux-saga/effects';
import { REQUEST_COURSEHISTORY, RECEIVE_COURSEHISTORY } from '../actionTypes';
export function* fetchCourseHistory(action) {
try {
const response = yield call(
action.Api.getCourseHistory,
action.requestParms,
action.term,
action.mode,
action.acaCareer,
);
yield put({ type: RECEIVE_COURSEHISTORY, response, status: 'success' });
} catch (error) {
yield put({ type: RECEIVE_COURSEHISTORY, response: error, status: 'error' });
}
}
export default function* CourseHistorySaga() {
yield takeEvery(REQUEST_COURSEHISTORY, fetchCourseHistory);
}