ih-black-lion
Version:
State handler for Arus projects
22 lines (19 loc) • 611 B
JavaScript
import { takeEvery, put, call } from 'redux-saga/effects';
import { REQUEST_SCHEDULE, RECEIVE_SCHEDULE } from '../actionTypes';
export function* fetchSchedule(action) {
try {
const response = yield call(
action.Api.getSchedule,
action.requestParams,
action.term,
action.mode,
action.acadCareer,
);
yield put({ type: RECEIVE_SCHEDULE, response, status: 'success' });
} catch (error) {
yield put({ type: RECEIVE_SCHEDULE, response: error, status: 'error' });
}
}
export default function* ScheduleSaga() {
yield takeEvery(REQUEST_SCHEDULE, fetchSchedule);
}