So I'm developing a c# API that returns some status codes, and this is my function on controller:
public IHttpActionResult validateToken(HttpRequestMessage request, string token)
{
bool result = AuthUser.validateToken(token);
if (!result)
{
return BadRequest();
}
else
{
return Ok();
}
}
Then I have my axios to make the requests:
this.$axios.get("validateResetToken/" + token)
.then((response) => {
console.log(response)
})
.catch((error) => console.log(error));
And when the API returns the 200, Ok(), the response gives me a object:
But when the return is anything than Ok [ 200 ], the response is always undifined and I cant figure it out why.
Why cant I have always a response, to get the status code, in this case 200 or 400.