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

163
Visualizações
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
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