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

129
Vistas
Why is Axios not recognizing correct information?

I am working on a practice login page in JS and JSON server as well as Axios. I am trying to verify that the username and password being entered are indeed on the DB. However it seems that even if I enter a username that I have already stored in the DB it will return as if it is false. Here is how I implemented it so far, this is before the password is checked for:

export const UseStorage = async (loginInfo) => {
var userLegit = true;
var passLegit = true;

try {
    const response = await axios.get(`http://localhost:4000/users?user=${loginInfo.username.value}`);
    console.log(response);
  } catch (error) {
    console.error('Not a valid username');
    alert("Incorrect username or password. Please try again")
    var userLegit = false;
    console.log(userLegit)
  }

The input is being taken in correctly on my form as I am also logging that before the function is ran, but the issue stems once I get into the actual search of the value within the function. Thanks for the help

"users": [
{
  "pass": "123",
  "user": "foobar",
  "id": 1
about 4 years ago · Juan Pablo Isaza
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