Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

124
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda