diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html index 3b93366..4c363ef 100644 --- a/src/app/dashboard/dashboard.component.html +++ b/src/app/dashboard/dashboard.component.html @@ -43,7 +43,7 @@ Actions - + diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index 1b0989d..1af3fbf 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -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; + }); + } }); } }