I am using angular 7 and i need to get "Response Header" from the given API in service file without using "subscribe". please help me in this
i have tried by using many google answers but none of them worked.I am not able use subscribe in service.ts file because i am getting error in component.ts file as we can t use subscribe two times
login(email: string, password: string ) {
this.email = email;
this.password = password;
return this.http.post<any>(`this.url/auth/login`, { email, password})
.pipe(map(user => {
var currentuser:any = { user: user.user, token: user.token};
if (currentuser && user.token) {
localStorage.setItem('currentUser', JSON.stringify(currentuser));
this.currentUserSubject.next(currentuser);
}
return user;
}));
}
Expected result :
need to get ""response header for the above api .. Note : "Response header" means -- content length , token ,Content-Type , Etag, etcc
Actual result :
I am getting only the body for this not headers