I'm still in trouble with AngularJS 1.5.3.
I'm trying to do some logic with the 401 Unauthorized error in my $http
requests.
Here the code.
...
var req = {
url: 'http://localhost:8080/news',
method: 'GET'
};
$http(req)
.then(successHandler)
.catch(function(message) {
console.log(message);
if(message.status === "401") {
// logic here
}
});
...
After running this little piece of code without auth token I got:
Object {data: null, status: -1, config: Object, statusText: ""}
The browser know is 401, and display it in an error before the console.log
.
What the heck is happening?