correction bug list et tache vides
This commit is contained in:
parent
6549070d2c
commit
7955ccad42
9 changed files with 35 additions and 69 deletions
|
|
@ -25,3 +25,5 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<app-footer></app-footer>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ export class PageToDoListComponent implements OnInit {
|
|||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
//récupère les todoLists existantes en fonctoin de l'id de la team en utilisant le service
|
||||
this.TodoService.getToDoListByTeamId()?.subscribe((listTodos: any) => {
|
||||
console.log(listTodos);
|
||||
this.listTodos = listTodos;
|
||||
|
|
@ -28,23 +29,21 @@ export class PageToDoListComponent implements OnInit {
|
|||
this.idTodo = 0;
|
||||
});
|
||||
}
|
||||
//Ajouter une todo List
|
||||
|
||||
//Ajouter une todo List si l'input n'est pas vide
|
||||
addTodoByTeamId() {
|
||||
const todoList: ToDoList = {
|
||||
nom: this.todoListTitle,
|
||||
taches: [],
|
||||
id: 0,
|
||||
};
|
||||
this.TodoService.addTodoByTeamId(todoList)?.subscribe((resp) => {
|
||||
console.log(todoList);
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
deleteTodo(id: number): void {
|
||||
window.alert('La to-do-List a bien été supprimé!');
|
||||
this.TodoService.deleteTodoById(id).subscribe((resp) => {
|
||||
window.location.reload();
|
||||
});
|
||||
if (this.todoListTitle != '') {
|
||||
this.TodoService.addTodoByTeamId(todoList)?.subscribe((resp) => {
|
||||
console.log(todoList);
|
||||
window.location.reload(); //rafraîchit l'aperçu
|
||||
});
|
||||
}else{
|
||||
window.alert('Il faut saisir du texte'); // sinon msg d'erreur
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue