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

598
Views
In try to take value from axios post request but return [promise object]

I'm try to get the return value from my route in golang api,, that return an id.

my route :

POST: http://localhost:1323/profile/valid

my axios request:

export async function validLogin(email, password) { 

  const data = JSON.stringify({ email, password });
  let headers = {
    'Content-Type': 'application/json;charset=UTF-8',
  };

  await axios.post('http://localhost:1323/profile/valid', data, headers)
  .then(response => {
    return response.data;
  })
  .catch(err =>{
    console.log(err);
  });

}

the function works, but return [promise object] or undefined.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The async function always returns Promise. To extract the data out of this function, call await for the promise returned above from another async function.

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!