Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

313
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda