avancées signup

This commit is contained in:
Sana EL HIRI 2022-03-07 18:29:53 +01:00
parent 58abccca86
commit c07b32cad1
2 changed files with 13 additions and 8 deletions

View File

@ -8,4 +8,5 @@ export interface Membre {
couleur: string; couleur: string;
passwordConfirm: string; passwordConfirm: string;
roleList: string[]; roleList: string[];
teamId?: string;
} }

View File

@ -5,7 +5,7 @@ import {
FormGroup, FormGroup,
Validators, Validators,
} from '@angular/forms'; } from '@angular/forms';
import { Router, RouterLink } from '@angular/router'; import { Router} from '@angular/router';
import { Team } from 'src/app/models/team'; import { Team } from 'src/app/models/team';
import { TeamService } from 'src/app/services/team.service'; import { TeamService } from 'src/app/services/team.service';
import { Membre } from '../../models/membre'; import { Membre } from '../../models/membre';
@ -59,7 +59,7 @@ export class PageSignupComponent implements OnInit {
} }
public onSubmit(): void { public onSubmit(): void {
const teamIdValue = this.signupForm.value['']; let teamIdValue = '';
const teamNameValue = this.signupForm.value['teamNameFc']; const teamNameValue = this.signupForm.value['teamNameFc'];
const idValue = this.signupForm.value['']; const idValue = this.signupForm.value[''];
const prenomValue = this.signupForm.value['firstNameFc']; const prenomValue = this.signupForm.value['firstNameFc'];
@ -85,16 +85,20 @@ export class PageSignupComponent implements OnInit {
couleur: couleurValue, couleur: couleurValue,
dateNaissance: dateNaissanceValue, dateNaissance: dateNaissanceValue,
passwordConfirm: passwordConfirmValue, passwordConfirm: passwordConfirmValue,
//team: teamIdValue, teamId: teamIdValue,
roleList: roleValue, roleList: roleValue,
}; };
if (membre.email !== '' && membre.password !== '' && team.nom!== '') { if (membre.email !== '' && membre.password !== '' && team.nom!== '') {
this.teamService.addTeam(team).subscribe((resp) => { this.teamService.addTeam(team).subscribe((respTeam) => {
return resp teamIdValue = respTeam.id;
}); console.log(teamIdValue);
this.authService.signup(membre).subscribe((resp) => { this.authService.signup(membre).subscribe((respMembre) => {
this.router.navigate(['accueil']); this.router.navigate(['accueil']);
console.log(teamIdValue);
return respMembre
});
}); });
} else { } else {
// affichage erreur // affichage erreur