|
|
|
@ -30,6 +30,7 @@ export class RegisterComponent implements OnInit, OnDestroy {
|
|
|
|
|
register() {
|
|
|
|
|
if (this.currentUser.status === 'Parrain') {
|
|
|
|
|
this.parrain.status = this.currentUser.status;
|
|
|
|
|
this.parrain.secretCode = this.getRandomArbitrary(1111, 9999).toString();
|
|
|
|
|
this.authService.signUp(this.parrain);
|
|
|
|
|
}else if (this.currentUser.status === 'Commercant') {
|
|
|
|
|
this.commercant.status = this.currentUser.status;
|
|
|
|
@ -37,6 +38,12 @@ export class RegisterComponent implements OnInit, OnDestroy {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// On renvoie un nombre aléatoire entre une valeur min (incluse)
|
|
|
|
|
// et une valeur max (exclue)
|
|
|
|
|
getRandomArbitrary(min, max) {
|
|
|
|
|
return Math.trunc(Math.random() * (max - min) + min);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loadHomeComponent() {
|
|
|
|
|
this.router.navigate(['/']);
|
|
|
|
|
}
|
|
|
|
|