finish all getall into table

This commit is contained in:
2025-11-18 12:04:51 +01:00
parent 73ce63d7d0
commit 4b5fd254a1
57 changed files with 3048 additions and 82 deletions

View File

@@ -0,0 +1,56 @@
import {Component, inject, OnInit, signal} from '@angular/core'; // Importation de la fonction input() et des components
import {Modal} from "../modal/modal";
import {NzButtonComponent} from "ng-zorro-antd/button";
import {BooksService, GetBookDto} from "../../services/api";
import {NzNotificationService} from "ng-zorro-antd/notification";
import {firstValueFrom} from "rxjs";
import {NzTableComponent} from "ng-zorro-antd/table";
import {NzDividerComponent} from "ng-zorro-antd/divider";
import {UpdateBook} from "../update-book/update-book";
@Component({
selector: 'app-book-table',
imports: [
Modal,
NzButtonComponent,
NzTableComponent,
NzDividerComponent,
UpdateBook,
],
templateUrl: './book-table.html',
styleUrl: './book-table.css',
})
export class BookTable implements OnInit {
private booksService = inject(BooksService);
private notificationService = inject(NzNotificationService)
books = signal<GetBookDto[]>([]);
booksLoading = signal<boolean>(false);
async ngOnInit() {
await this.fetchbooks();
}
async fetchbooks() {
this.booksLoading.set(true)
try {
const books = await firstValueFrom(this.booksService.getAllBooksEndpoint());
this.books.set(books);
} catch (e) {
this.notificationService.error(
'Erreur',
'Erreur de communication avec l\'API'
)
}
this.booksLoading.set(false)
}
delete() {
return
}
}