Perhaps I'm asking a stupid thing, but I'm really interested to know how I can achieve periodic requests for the api, on my backend I implemented an endpoint that prepares data and sends it to AWS Lambda, where an excel file is prepared and sent back to the api, so, in while the file is being prepared, the object has the pending status, when Lambda returns the file, the status turns into a complete, when the user clicks the download button, the frontend should send requests with a timeout of 1.5 seconds to the api and watch the request status, how can I implement such a tool? below is an example of the code of two sagas, I thought that this could be implemented through them
try {
const payload = action.payload;
if (payload.downloader) {
const response = yield audienceApi.getAllUsers(payload.botId, payload.page, payload.downloader);
if (response) {
yield put(audienceActions.addOrUpdateReport(response));
yield put(audienceActions.getAllUsersSuccess(response));
}
} else {
let response = yield audienceApi.getAllUsers(payload.botId, payload.page);
if (response) {
yield put(audienceActions.getAllUsersSuccess(response));
}
}
} catch (err) {}
}
function* addOrUpdateReportSaga(payload) {
try {
// if (payload.status === 'pending') {
yield delay(1500);
yield audienceApi.downloadPreparedFile(payload.file_id)
// yield put(audienceActions.downloadPreparedFile(payload));
// }
} catch (err) {}
}```