update tache

This commit is contained in:
HarmandI 2022-02-17 09:44:18 +01:00
parent a9970a50eb
commit 82321df395
4 changed files with 58 additions and 11598 deletions

11633
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,7 @@
"@angular/platform-browser": "~13.0.0", "@angular/platform-browser": "~13.0.0",
"@angular/platform-browser-dynamic": "~13.0.0", "@angular/platform-browser-dynamic": "~13.0.0",
"@angular/router": "~13.0.0", "@angular/router": "~13.0.0",
"@ng-bootstrap/ng-bootstrap": "^12.0.0",
"bootstrap": "^5.1.3", "bootstrap": "^5.1.3",
"bootstrap-icons": "^1.8.1", "bootstrap-icons": "^1.8.1",
"jwt-decode": "^3.1.2", "jwt-decode": "^3.1.2",

View File

@ -60,19 +60,24 @@ console.log(idTodoList);
//modifier la tâche //modifier par l'input
modifier(tache: Tache): void { modifier(tache: Tache): void {
this.beforeEditCache = tache.texte; this.beforeEditCache = tache.texte;
tache.editing = true; tache.editing = true;
} }
// modifier l'apparence focus // ajouter la modification dans la liste
doneEdit(tache: Tache): void { doneEdit(tache: Tache): void {
if (tache.texte.trim().length === 0) { if (tache.texte.trim().length === 0) {
tache.texte = this.beforeEditCache; tache.texte = this.beforeEditCache;
} }
this.casesRestantes= this.casesQuiRestes(); this.casesRestantes= this.casesQuiRestes();
tache.editing = false; tache.editing = false;
this.TodoService.updateTache(tache).subscribe((resp)=>{
console.log(tache);
window.location.reload();
})
} }
// annuler la modification // annuler la modification

View File

@ -21,11 +21,18 @@ export class TodoService {
} }
deleteTacheById(idTache: any): Observable<any> { deleteTacheById(idTache: any): Observable<any> {
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<any> { addTache(newtache: Tache, idTodoList: number): Observable<any> {
console.log(newtache +'gkggg'); // console.log(newtache);
return this.http.post(`${this.apiUrl}/taches/add/${idTodoList}`, newtache); return this.http.post(`${this.apiUrl}/taches/add/${idTodoList}`, newtache);
} }
updateTache(tache: Tache): Observable<any> {
console.log(tache);
return this.http.put(`${this.apiUrl}/taches/update/1`, tache);
}
} }