I am facing an issue wherein, when I use the http.post method, I encounter an error stating "TypeError: Cannot read property 'toLowerCase' of undefined". I have attempted to downgrade Angular to version 8.0.0 in order to resolve this problem, but to no avail.
Here is my login service code:
login(model: any)
{
return this.http.post(this.baseUrl, model)
.pipe(map((response: any) => {
const user = response;
if(user){
localStorage.setItem('token', user);
}
}));
}
This is how I call the login method in my component:
login(){
this.authService.login(this.model)
.subscribe(next =>{
console.log('You have been logged in');
},err => {
console.log(err);
});
}