Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

85
Vistas
Periodic api requests in React?

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) {}
}```
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda