Hi,
Great tutorial thanks for it.
I have an issue to display the error if user email or password is incorrect.
Please let me know how should I fix it?
in user authentication service I'm getting this response from the server, how can I pass this response to alert service, I see you are passing response when the user logged in successfully but not if user put invalid email.
Response {_body: "{"error":"Invalid email."}", status: 200, ok: true, statusText: "OK", headers: Headers…}
login(email: string, password: string) {
return this.http.post(this.config.apiUrl + '/api/users/login', { email: email, password: password })
.map((response: Response) => {
console.log('resonse',response);
// login successful if there's a jwt token in the response
let user = response.json();
if (user && user.token) {
// store user details and jwt token in local storage to keep user logged in between page refreshes
localStorage.setItem('currentUser', JSON.stringify(user));
}
});
}
Hi,
Great tutorial thanks for it.
I have an issue to display the error if user email or password is incorrect.
Please let me know how should I fix it?
in user authentication service I'm getting this response from the server, how can I pass this response to alert service, I see you are passing response when the user logged in successfully but not if user put invalid email.