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

123
Views
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
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!