Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

91
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda