created all delete functions
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
<div style="display: flex; align-items: center;">
|
||||
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer"></nz-icon>
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
<nz-icon nzType="delete" nzTheme="outline" class="text-red-600 cursor-pointer"></nz-icon>
|
||||
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(author.id)" class="text-red-600 cursor-pointer"></nz-icon>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<div style="display: flex; align-items: center;">
|
||||
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer"></nz-icon>
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
<nz-icon nzType="delete" nzTheme="outline" class="text-red-600 cursor-pointer"></nz-icon>
|
||||
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(book.id)" class="text-red-600 cursor-pointer"></nz-icon>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<div style="display: flex; align-items: center;">
|
||||
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer"></nz-icon>
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
<nz-icon nzType="delete" nzTheme="outline" class="text-red-600 cursor-pointer"></nz-icon>
|
||||
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(loan.id)" class="text-red-600 cursor-pointer"></nz-icon>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,9 +46,7 @@
|
||||
(click)="openEditModal(user)">
|
||||
</nz-icon>
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(user.id)"
|
||||
class="text-red-600 cursor-pointer">
|
||||
</nz-icon>
|
||||
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(user.id)" class="text-red-600 cursor-pointer"></nz-icon>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user