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

308
Visualizações
Not getting a specified data from get request in json server

I want specific data while making a GET request from the json server but i am getting an error of undefined. Here is the code for get request.

onSubmit={(values) => {
    axios
      .get(`http://localhost:3001/users/${values.id}`)
      .then((resp) => {
        if (values.email === resp.data.email) {
          console.log(resp.data);
        } else console.log("usereename or pass invalid");

and here is the data in my json server

 {
  "users": [
    {
      "id": "1afe2286-3e2b-4113-b155-999d7b289f39",
      "email": "zeeshan.naseeb11@gmail.com",
      "password": "112"
    },
    ]}

this is the error . kindly hel

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The first argument passed to an onSubmit event handler (which you assign to values) is the event object.

It doesn't have an id (hence undefined appearing in the URL).

You need to get your ID from somewhere it actually exists.

about 4 years ago · Juan Pablo Isaza Relatório
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