I'm working on a situation where I need to call single API continuously after every 60 seconds
My concern is how should I call the same API request using redux-saga
I'm using the normal redux-saga action, for example, get the list of employee, which fetches the list of employee every 60 seconds
Using redux-saga, react-redux and react
import { delay } from 'redux-saga';
import { call, put, takeLatest, all } from 'redux-saga/effects';
export function* fetchContinuously(action) {
  yield call(api);
  yield call(delay, 60000);
  yield put({ type: "FETCH_CONTINUOUSLY" })
}
function* actionWatcher() {
  yield takeLatest('FETCH_CONTINUOUSLY', fetchContinuously)
}
export default function* rootSaga() {
  yield all([
    actionWatcher(),
  ]);
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With