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

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

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