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 = { let data = {
email: this.email, email: this.email,
hashPass: this.hashage(this.password) hashPass: this.password
}; };
this.messageService this.messageService
.post('user/auth', data) .post('user/auth', data)
.subscribe( retour => this.onSeConnecterCallback(retour)); .subscribe( retour => this.onSeConnecterCallback(retour), err => this.onSeConnecterCallback(err));
} }
} }
onSeConnecterCallback(retour): void onSeConnecterCallback(retour): void
{ {
console.log(retour); if(retour.status !== "success") {
this.errorMessage = retour.error.data.reason;
if(retour.status !== 200) this.hasError = true;
{
console.log("noooo !");
//this.errorMessage = retour.error.data.reason;
//this.hasError = true;
} }
else { else {
console.log("yeeess !"); this.router.navigateByUrl( '/user/search');
//this.router.navigateByUrl( '/search' );
} }
} }