Update: subscribe & onSeConnecterCallback()

This commit is contained in:
Yûki VACHOT 2021-12-04 11:39:09 +01:00
parent 6444df567b
commit be318e8c06

View file

@ -39,28 +39,23 @@ export class PageLoginComponent implements OnInit
{
let data = {
email: this.email,
hashPass: this.hashage(this.password)
hashPass: this.password
};
this.messageService
.post('user/auth', data)
.subscribe( retour => this.onSeConnecterCallback(retour));
.subscribe( retour => this.onSeConnecterCallback(retour), err => this.onSeConnecterCallback(err));
}
}
onSeConnecterCallback(retour): void
{
console.log(retour);
if(retour.status !== 200)
{
console.log("noooo !");
//this.errorMessage = retour.error.data.reason;
//this.hasError = true;
if(retour.status !== "success") {
this.errorMessage = retour.error.data.reason;
this.hasError = true;
}
else {
console.log("yeeess !");
//this.router.navigateByUrl( '/search' );
this.router.navigateByUrl( '/user/search');
}
}