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

212
Views
How to access response server on 404 error code - axios

I have an api service like this:

api.interceptors.response.use(
  (response: any) => {
    console.log("response",response)
    if (response.status === 200) {
      response = response.data['data'] ?? response.data;
    }
    return response
  },

  (error) => {
    // TODO handle errors
    const code = parseInt(error.response && error.response.status)
    const data = error.response.errors;

    if (code === 404) {
      console.log("error",error)
      data.forEach(itemError => {
        toast.error(itemError, {
          theme: 'colored',
        });
      });
     
    }

  }
)

but server send to me response message when error code is 404. how I can access to this data?

for example this is a response of 404 server error:

{"status":false,"message":"bad request!","errors":["invalid otp code"],"data":null}
about 4 years ago · Juan Pablo Isaza
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!