1.2 #11

Merged
jank merged 6 commits from main into prod 2025-01-21 12:37:13 +00:00
2 changed files with 14 additions and 5 deletions
Showing only changes of commit e0d9b8295e - Show all commits

View file

@ -43,7 +43,7 @@
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef> Actions </th>
<td mat-cell *matCellDef="let element">
<button mat-flat-button color="warn" (click)="deleteLink(element.id)">Delete</button>
<button mat-flat-button color="warn" (click)="deleteLink(element)">Delete</button>
</td>
</ng-container>

View file

@ -54,10 +54,19 @@ export class DashboardComponent {
this.router.navigate(['create-link']);
}
deleteLink(id: string) {
this.linkService.deleteLink(id); // TODO Check if something went wrong
this.links = this.links.filter(link => {
return link.id != id;
deleteLink(link: Link) {
this.dialog.open(ConfirmationModalComponent, {
data: {
title: "Are you sure?",
description: "Are you sure that you want to delete " + link.name + "?",
}
}).afterClosed().subscribe((accepted: boolean) => {
if (accepted) {
this.linkService.deleteLink(link.id); // TODO Check if something went wrong
this.links = this.links.filter(givenLink => {
return givenLink.id != link.id;
});
}
});
}
}