i'm trying to perform a login, to make it I use firebase ,the login system work as well , but I'm not able to get the error name from de auth service to my login component. I have tried this :
SignIn(email: string, password: string) {
this.angularFireAuth
.signInWithEmailAndPassword(email, password)
.then(res => {
console.log('Connected OK');
this.setValueError(false);
this.router.navigate(['/user']);
})
.catch(err => {
console.log('Erreur:',err.message);
this.setValueError(true);
});
}
setValueError(newValue): void {
this.isError.next(newValue);
}
And this is my get function
getValueError(): Observable<boolean> {
return this.isError.asObservable();
}
And on my login component I got this :
signIn() {
this.authenticationService.SignIn(this.email, this.password);
this.authenticationService.getValueError().subscribe((value) => {
alert(value);
});
this.email = '';
this.password = '';
}
But the alert returns two values, for example if I make a mistake on my login I got FALSE and TRUE.
I want to get only the trust value, to know if there is a login error.
Thanks for help