diff --git a/src/app/models/membre.ts b/src/app/models/membre.ts index 11849b0..970362e 100644 --- a/src/app/models/membre.ts +++ b/src/app/models/membre.ts @@ -10,5 +10,5 @@ export interface Membre { couleur: string; passwordConfirm: string; roleList: string[]; - team?: Team[]; + team?: Team; } diff --git a/src/app/pages/page-add-member/page-add-member.component.ts b/src/app/pages/page-add-member/page-add-member.component.ts index cab3b5d..c9209e1 100644 --- a/src/app/pages/page-add-member/page-add-member.component.ts +++ b/src/app/pages/page-add-member/page-add-member.component.ts @@ -89,11 +89,11 @@ export class PageAddMemberComponent implements OnInit { const mail: Mail = { recipient: emailValue, - subject: "Votre mot de passe Organizee", + subject: "Votre mot de passe provisoire Organizee", message: `Bonjour ${firstNameValue}!\n Voici vos identifiants de connexion : \n Identifiant : ${emailValue} - Mot de passe : ${passwordValue} - Veuillez modifier votre mot de passe à la première connexion : + Mot de passe provisoire : ${passwordValue} + Veuillez modifier votre mot de passe dès la première connexion : http://localhost:4200/password-oublie ` }; diff --git a/src/app/pages/page-delete-member/page-delete-member.component.html b/src/app/pages/page-delete-member/page-delete-member.component.html index da8ade7..ee1f3fb 100644 --- a/src/app/pages/page-delete-member/page-delete-member.component.html +++ b/src/app/pages/page-delete-member/page-delete-member.component.html @@ -23,7 +23,7 @@ id = "bouton-ajout" type="button" class="btn btn-primary btn-lg bouton-oui" - (clickDelete)="onClickDelete()" + (click)="onClickDelete()" [hidden]="parent == false" >Oui, je souhaite supprimer ce compte diff --git a/src/app/pages/page-delete-member/page-delete-member.component.ts b/src/app/pages/page-delete-member/page-delete-member.component.ts index f512194..f923b58 100644 --- a/src/app/pages/page-delete-member/page-delete-member.component.ts +++ b/src/app/pages/page-delete-member/page-delete-member.component.ts @@ -16,6 +16,7 @@ export class PageDeleteMemberComponent implements OnInit { constructor(private membreService: MembreService, private tokenService: TokenService, + private router: Router, private route: ActivatedRoute) { this.membreInfos = ''; this.parent = false; @@ -46,8 +47,9 @@ export class PageDeleteMemberComponent implements OnInit { /********************** Suppresion d'un membre au click ********************/ onClickDelete(): void { - this.membreService.deleteMembre(this.membreInfos.id).subscribe((resp) => { - return resp + console.log("coucou"); + this.membreService.deleteMembre(this.membreInfos).subscribe((resp) => { + this.router.navigate(['compte']); }); } } diff --git a/src/app/pages/page-signup/page-signup.component.ts b/src/app/pages/page-signup/page-signup.component.ts index 49fc0f8..288acfd 100644 --- a/src/app/pages/page-signup/page-signup.component.ts +++ b/src/app/pages/page-signup/page-signup.component.ts @@ -59,7 +59,6 @@ export class PageSignupComponent implements OnInit { } public onSubmit(): void { - let teamIdValue = ''; const teamNameValue = this.signupForm.value['teamNameFc']; const idValue = this.signupForm.value['']; const prenomValue = this.signupForm.value['firstNameFc']; @@ -72,30 +71,31 @@ export class PageSignupComponent implements OnInit { const roleValue = ['ROLE_PARENT']; const team: Team = { - id : teamIdValue, + id : "", nom : teamNameValue, }; - const membre: Membre = { - id: idValue, - nom: nomValue, - prenom: prenomValue, - email: emailValue, - password: passwordValue, - couleur: couleurValue, - dateNaissance: dateNaissanceValue, - passwordConfirm: passwordConfirmValue, - team:[teamIdValue, teamNameValue], - roleList: roleValue, - }; - - if (membre.email !== '' && membre.password !== '' && team.nom!== '') { + if (emailValue !== '' && passwordValue !== '' && team.nom!== '') { + //création Team this.teamService.addTeam(team).subscribe((respTeam) => { - teamIdValue = respTeam.id; - console.log(teamIdValue); + //récupération de l'id auto-généré (respTeam.id) dans l'id team (team.id) + team.id = respTeam.id; + //création objet membre avec l'objet team crée + const membre: Membre = { + id: idValue, + nom: nomValue, + prenom: prenomValue, + email: emailValue, + password: passwordValue, + couleur: couleurValue, + dateNaissance: dateNaissanceValue, + passwordConfirm: passwordConfirmValue, + team: team, + roleList: roleValue, + }; + //création du membre en bdd avec l'objet membre this.authService.signup(membre).subscribe((respMembre) => { this.router.navigate(['accueil']); - console.log(teamIdValue); return respMembre }); diff --git a/src/app/pages/page-update-member/page-update-member.component.html b/src/app/pages/page-update-member/page-update-member.component.html index 5361655..32b822c 100644 --- a/src/app/pages/page-update-member/page-update-member.component.html +++ b/src/app/pages/page-update-member/page-update-member.component.html @@ -80,8 +80,7 @@ placeholder="" name="Role" formControlName="roleFc" - value="{{membreInfos.roleList}}" - [(ngModel)]="membreInfos.roleList" + value="" > diff --git a/src/app/services/membre.service.ts b/src/app/services/membre.service.ts index 5d30104..a69bb6b 100644 --- a/src/app/services/membre.service.ts +++ b/src/app/services/membre.service.ts @@ -46,7 +46,7 @@ export class MembreService { } deleteMembre(membre: Membre): Observable{ - return this.http.delete(`${this.apiUrl}/membres/delete/${membre.id}`); + return this.http.delete(`${this.apiUrl}/membres/delete/${membre.id}`, {responseType: "text"}); } updateMembre(membre: Membre): Observable | void { diff --git a/src/environments/environment.ts b/src/environments/environment.ts index bd6eab6..f6c7117 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -6,7 +6,8 @@ export const environment = { production: false, apiUrl: 'http://localhost:8088', tokenKey: 'TOKEN-ORGANIZEE', - debug: true, + // pour afficher des infos en mode debug + debug: false, }; /*