0
votes

I have a login function which returns the user id and jwt token on successful login and different errors like username not found or incorrect password etc. if the data provided is incorrect. I tested the api using postman and it works fine but when i make a request from the front end to the login end point. It returns the credentials if the login attempt is valid but does not respond with and error if the login details are incorrect. Login code Currently im only logging the axios response to the console Axios request

1
You are missing a .catch() block in your request. Also it's better to paste your code here rather than attach imagesKmoSkillz

1 Answers

0
votes

As per my comment above, you need to catch errors from your request.

axios.post("[your url here]")
.then(res=>{
    console.log(res);
})
.catch(err=>{
    console.log(err);
});