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,55 @@
import {Component, inject, OnInit, signal} from '@angular/core';
import {Modal} from "../modal/modal";
import {NzButtonComponent} from "ng-zorro-antd/button";
import {AuthorsService, GetAuthorDto} 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 {UpdateAuthor} from "../update-author/update-author";
@Component({
selector: 'app-author-table',
imports: [
Modal,
NzButtonComponent,
NzTableComponent,
NzDividerComponent,
UpdateAuthor
],
templateUrl: './author-table.html',
styleUrl: './author-table.css',
})
export class AuthorTable implements OnInit {
private authorsService = inject(AuthorsService);
private notificationService = inject(NzNotificationService)
authors = signal<GetAuthorDto[]>([]);
authorsLoading = signal<boolean>(false);
async ngOnInit() {
await this.fetchauthors();
}
async fetchauthors() {
this.authorsLoading.set(true)
try {
const authors = await firstValueFrom(this.authorsService.getAllAuthorsEndpoint());
this.authors.set(authors);
} catch (e) {
this.notificationService.error(
'Erreur',
'Erreur de communication avec l\'API'
)
}
this.authorsLoading.set(false)
}
delete() {
return
}
}