ih-black-lion
Version:
State handler for Arus projects
20 lines (17 loc) • 622 B
JavaScript
import { takeEvery, put, call } from 'redux-saga/effects';
import { REQUEST_FINANCIAL_AID, RECEIVE_FINANCIAL_AID } from '../actionTypes';
export function* fetchFinancialAid(action) {
try {
const response = yield call(
action.Api.getFinancialAid,
action.requestParams,
action.financialAidParams,
);
yield put({ type: RECEIVE_FINANCIAL_AID, response, status: 'success' });
} catch (error) {
yield put({ type: RECEIVE_FINANCIAL_AID, response: error, status: 'error' });
}
}
export default function* FinancialAidSaga() {
yield takeEvery(REQUEST_FINANCIAL_AID, fetchFinancialAid);
}