Here is the code I use to fetch data:
login() {
const url = api + 'login';
this.http.post(url, this.userModel)
.subscribe(
data => {
localStorage.token = data.token;
this.router.navigate(['/home']);
},
error => {
alert(error.error.error);
}
)
}
This will result in a JSON object like this:
{
message: "logged In Successful!",
token: "e4affa4633fb046333731ae6fadcb980b98636b513a0fb80721759267b4efa5c9b7845663f2b1288"
}
Although it works and saves to local storage, I keep encountering this error in my console. Why does it happen?