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;
passwordConfirm: string;
roleList: string[];
teamId?: string;
}

View File

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