diff --git a/src/app/components/author-table/author-table.html b/src/app/components/author-table/author-table.html index 18fc6ef..be4e7c5 100644 --- a/src/app/components/author-table/author-table.html +++ b/src/app/components/author-table/author-table.html @@ -43,7 +43,7 @@
- +
diff --git a/src/app/components/author-table/author-table.ts b/src/app/components/author-table/author-table.ts index a778d1f..8b2db78 100644 --- a/src/app/components/author-table/author-table.ts +++ b/src/app/components/author-table/author-table.ts @@ -51,7 +51,19 @@ export class AuthorTable implements OnInit { this.authorsLoading.set(false) } - delete() { - return + async delete(author:number) { + try { + await firstValueFrom(this.authorsService.deleteAuthorEndpoint(author)) + this.notificationService.success( + 'Success', + 'Suppression effectuée' + ) + } catch (e) { + this.notificationService.error( + 'Erreur', + 'Impossible de supprimer la ligne' + ) + } + await this.fetchauthors(); } } diff --git a/src/app/components/book-table/book-table.html b/src/app/components/book-table/book-table.html index c7b4cd5..bb2a7db 100644 --- a/src/app/components/book-table/book-table.html +++ b/src/app/components/book-table/book-table.html @@ -22,7 +22,7 @@
- +
diff --git a/src/app/components/book-table/book-table.ts b/src/app/components/book-table/book-table.ts index b9e51cb..e972efe 100644 --- a/src/app/components/book-table/book-table.ts +++ b/src/app/components/book-table/book-table.ts @@ -50,7 +50,19 @@ export class BookTable implements OnInit { this.booksLoading.set(false) } - delete() { - return + async delete(book:number) { + try { + await firstValueFrom(this.booksService.deleteBookEndpoint(book)) + this.notificationService.success( + 'Success', + 'Suppression effectuée' + ) + } catch (e) { + this.notificationService.error( + 'Erreur', + 'Impossible de supprimer la ligne' + ) + } + await this.fetchbooks(); } } diff --git a/src/app/components/loan-table/loan-table.html b/src/app/components/loan-table/loan-table.html index c776ef5..8869ee7 100644 --- a/src/app/components/loan-table/loan-table.html +++ b/src/app/components/loan-table/loan-table.html @@ -23,7 +23,7 @@
- +
diff --git a/src/app/components/loan-table/loan-table.ts b/src/app/components/loan-table/loan-table.ts index dcd7a2e..5a23847 100644 --- a/src/app/components/loan-table/loan-table.ts +++ b/src/app/components/loan-table/loan-table.ts @@ -51,7 +51,19 @@ export class LoanTable implements OnInit { this.loansLoading.set(false) } - delete() { - return + async delete(loan: number) { + try { + await firstValueFrom(this.loansService.deleteLoanEndpoint(loan)) + this.notificationService.success( + 'Success', + 'Suppression effectuée' + ) + } catch (e) { + this.notificationService.error( + 'Erreur', + 'Impossible de supprimer la ligne' + ) + } + await this.fetchloans(); } } diff --git a/src/app/components/user-table/user-table.html b/src/app/components/user-table/user-table.html index 82e48fe..aab66ec 100644 --- a/src/app/components/user-table/user-table.html +++ b/src/app/components/user-table/user-table.html @@ -46,9 +46,7 @@ (click)="openEditModal(user)"> - - +