I wrote the below code an when I ran the code in the browser, the login api is giving 403 response code. But I am not able to catch that error and console log it. Can anyone please tell me what is wrong in my code.
this.http
.post("login", {
username,
password
}).pipe(
catchError(err => {
console.log('Handling error locally and rethrowing it...', err);
return throwError(err);
})
)
.subscribe(
(response: any) => {
}
error=> {
console.log(error);
}
)