UNPKG

ih-black-lion

Version:

State handler for Arus projects

16 lines (13 loc) 574 B
import { takeEvery, put, call } from 'redux-saga/effects'; import { REQUEST_NOTIFICATIONS, RECEIVE_NOTIFICATIONS } from '../actionTypes'; export function* fetchNotifications(action) { try { const response = yield call(action.Api.getNotifications, action.requestParams); yield put({ type: RECEIVE_NOTIFICATIONS, response, status: 'success' }); } catch (error) { yield put({ type: RECEIVE_NOTIFICATIONS, response: error, status: 'error' }); } } export default function* NotificationsSaga() { yield takeEvery(REQUEST_NOTIFICATIONS, fetchNotifications); }