Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

288
Views
How to call api multiple times with delay in axios till I receive correct response?

Call an API multiple times with delay till I receive appropriate response.

Server needed more time to process an excel sheet information with 2000 rows.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You might be looking for axios-retry. Example from the readme:

import axiosRetry from 'axios-retry';

axiosRetry(axios, { retries: 3 });

axios.get('http://example.com/test') // The first request fails and the second returns 'ok'
  .then(result => {
    result.data; // 'ok'
  });
about 4 years ago · Juan Pablo Isaza Report

0

you can simply use axios interceptor like so:

axiosInstance.interceptors.response.use(
    (response) => response,
    (error) => {
        const originalRequest = error.config;

        if (error.response.status === 400) {
            originalRequest._retry = true;
           
        }
})

error param is when you want to deal with errors and response is where you want to deal with responses from backend

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!