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

161
Views
Api inside componentDidUpdate not returning data

I am running an Api inside componentDidUpdate. My code is -

componentDidUpdate(prevProps, nextProps) {
        const getSalaries = async () => {
            console.log("this ran");
            const data = await api.get(
                `/client/${this.props.client.id}/salary`
            );
        };

        if (this.props.client !== prevProps.client) {
            this.props.client.id !== undefined && getSalaries();
        }
    }

The statusCode returned by this request is 200 but there is no data returned. There is nothing wrong with this api. I have checked this on postman. When I console.log(data), it returned following-

{ "data": "", "status": 200, "statusText": "", "headers": { "access-control-expose-headers": "Access-Control-Expose-Headers, Content-Disposition", "cache-control": "no-cache, no-store, max-age=0, must-revalidate", "expires": "0", "pragma": "no-cache" }, "config": { "transformRequest": {}, "transformResponse": {}, "timeout": 0, "xsrfCookieName": "XSRF-TOKEN", "xsrfHeaderName": "X-XSRF-TOKEN", "maxContentLength": -1, "headers": { "Accept": "application/json, text/plain, /", "Authorization": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJVcGVuZHJhRGhhbWFsYUBrb2l6YWkuY29tIiwibmJmIjoxNjQ5OTg2MDcxLCJVc2VyLlVVSUQiOiI2MjIxZDdlZmM5ZTc3YzAwMDEwOWU1MWMiLCJpc3MiOiJ3d3cua29pemFpLmNvbSIsImV4cCI6MTY1MDAxNDg3M" }, "method": "get", "url": "http://34.124.147.12:8181/api/v1/client/6225c701c9e77c00014c6796/salary" }, "request": {} }

about 4 years ago · Santiago Trujillo
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!