feat: suppression d'un projet
This commit is contained in:
@@ -16,4 +16,8 @@ export class GroupService extends BaseService {
|
|||||||
|
|
||||||
return this.post<Group>("group/add",body);
|
return this.post<Group>("group/add",body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public deleteGroup(id_group:number):Observable<void>{
|
||||||
|
return this.delete<void>(`group/delete?id=${id_group}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,11 +43,17 @@
|
|||||||
Section groupes de tâches
|
Section groupes de tâches
|
||||||
</h2>
|
</h2>
|
||||||
<div>
|
<div>
|
||||||
|
<div>
|
||||||
@for (group of groups(); track group.id_group) {
|
@for (group of groups(); track group.id_group) {
|
||||||
<p>
|
<p>
|
||||||
{{ group.name_group }}
|
{{ group.name_group }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<button (click)="deleteGroup(group.id_group)">Supprimer le groupe </button>
|
||||||
}
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
<button (click)="toggleGroupForm()">Ajouter un groupe</button>
|
<button (click)="toggleGroupForm()">Ajouter un groupe</button>
|
||||||
|
|
||||||
|
|||||||
@@ -142,6 +142,24 @@ export class Home {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* deleteGroup
|
||||||
|
*/
|
||||||
|
public deleteGroup(id_group:number) {
|
||||||
|
let response:Observable<void> = this.groupService.deleteGroup(id_group);
|
||||||
|
|
||||||
|
response.subscribe({
|
||||||
|
next: () => {
|
||||||
|
this.groups.update((groups) => {
|
||||||
|
return groups.filter(((group) => group.id_group != id_group));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
console.error(`La suppression du groupe est impossible\nErreur: ${error.error.message}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public toggleProjectForm(): void {
|
public toggleProjectForm(): void {
|
||||||
this.showProjectForm = !this.showProjectForm;
|
this.showProjectForm = !this.showProjectForm;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user