diff --git a/package-lock.json b/package-lock.json index f44f725..7896c59 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2670,6 +2670,7 @@ "version": "5.1.3", "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.1.3.tgz", "integrity": "sha512-fcQztozJ8jToQWXxVuEyXWW+dSo8AiXWKwiSSrKWsRB/Qt+Ewwza+JWoLKiTuQLaEPhdNAJ7+Dosc9DOIqNy7Q==" + }, "brace-expansion": { @@ -7637,7 +7638,7 @@ } } }, -v + "strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", diff --git a/src/app/components/to-do-list/to-do-list.component.ts b/src/app/components/to-do-list/to-do-list.component.ts index 5664c70..6780170 100644 --- a/src/app/components/to-do-list/to-do-list.component.ts +++ b/src/app/components/to-do-list/to-do-list.component.ts @@ -60,19 +60,24 @@ console.log(idTodoList); - //modifier la tâche + //modifier par l'input modifier(tache: Tache): void { this.beforeEditCache = tache.texte; tache.editing = true; } - // modifier l'apparence focus + // ajouter la modification dans la liste doneEdit(tache: Tache): void { if (tache.texte.trim().length === 0) { tache.texte = this.beforeEditCache; } this.casesRestantes= this.casesQuiRestes(); tache.editing = false; + this.TodoService.updateTache(tache).subscribe((resp)=>{ + console.log(tache); + window.location.reload(); + }) + } // annuler la modification diff --git a/src/app/services/todo.service.ts b/src/app/services/todo.service.ts index d6adca3..8ca79ed 100644 --- a/src/app/services/todo.service.ts +++ b/src/app/services/todo.service.ts @@ -21,11 +21,18 @@ export class TodoService { } deleteTacheById(idTache: any): Observable { - return this.http.delete(`${this.apiUrl}/taches/delete/${idTache}`,{responseType:'text'}); + return this.http.delete(`${this.apiUrl}/taches/delete/${idTache}`, { + responseType: 'text', + }); } - addTache(newtache: Tache,idTodoList:number): Observable { - console.log(newtache +'gkggg'); + addTache(newtache: Tache, idTodoList: number): Observable { + // console.log(newtache); return this.http.post(`${this.apiUrl}/taches/add/${idTodoList}`, newtache); } + + updateTache(tache: Tache): Observable { +console.log(tache); + return this.http.put(`${this.apiUrl}/taches/update/1`, tache); + } }