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

307
Views
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 answers
Answer question

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 Report
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!