Update: subscribe & onSeConnecterCallback()
This commit is contained in:
parent
6444df567b
commit
be318e8c06
1 changed files with 6 additions and 11 deletions
|
|
@ -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' );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue