diff --git a/apps/client/src/app/components/home-watchlist/home-watchlist.component.ts b/apps/client/src/app/components/home-watchlist/home-watchlist.component.ts index 3b94e6915..daf512b34 100644 --- a/apps/client/src/app/components/home-watchlist/home-watchlist.component.ts +++ b/apps/client/src/app/components/home-watchlist/home-watchlist.component.ts @@ -94,20 +94,25 @@ export class HomeWatchlistComponent implements OnDestroy, OnInit { this.loadWatchlistData(); } - public ngOnDestroy() { - this.unsubscribeSubject.next(); - this.unsubscribeSubject.complete(); - } - - public onWatchlistItemDeleted(item: AssetProfileIdentifier) { + public onWatchlistItemDeleted({ + dataSource, + symbol + }: AssetProfileIdentifier) { this.dataService - .deleteWatchlistItem(item) + .deleteWatchlistItem({ dataSource, symbol }) .pipe(takeUntil(this.unsubscribeSubject)) .subscribe({ - next: () => this.loadWatchlistData() + next: () => { + return this.loadWatchlistData(); + } }); } + public ngOnDestroy() { + this.unsubscribeSubject.next(); + this.unsubscribeSubject.complete(); + } + private loadWatchlistData() { this.dataService .fetchWatchlist() diff --git a/apps/client/src/app/components/home-watchlist/home-watchlist.html b/apps/client/src/app/components/home-watchlist/home-watchlist.html index 98cda972e..ef073d331 100644 --- a/apps/client/src/app/components/home-watchlist/home-watchlist.html +++ b/apps/client/src/app/components/home-watchlist/home-watchlist.html @@ -12,12 +12,10 @@ diff --git a/libs/ui/src/lib/benchmark/benchmark.component.html b/libs/ui/src/lib/benchmark/benchmark.component.html index 645b0e752..14ff7f9f2 100644 --- a/libs/ui/src/lib/benchmark/benchmark.component.html +++ b/libs/ui/src/lib/benchmark/benchmark.component.html @@ -116,21 +116,26 @@ - @if (hasPermissionToDeleteWatchlistItem) { + @if (hasPermissionToDeleteItem) { } - + diff --git a/libs/ui/src/lib/benchmark/benchmark.component.ts b/libs/ui/src/lib/benchmark/benchmark.component.ts index aac70afdc..e773caecf 100644 --- a/libs/ui/src/lib/benchmark/benchmark.component.ts +++ b/libs/ui/src/lib/benchmark/benchmark.component.ts @@ -53,11 +53,11 @@ import { BenchmarkDetailDialogParams } from './benchmark-detail-dialog/interface export class GfBenchmarkComponent implements OnChanges, OnDestroy { @Input() benchmarks: Benchmark[]; @Input() deviceType: string; - @Input() hasPermissionToDeleteWatchlistItem: boolean; + @Input() hasPermissionToDeleteItem: boolean; @Input() locale = getLocale(); @Input() user: User; - @Output() watchlistItemDeleted = new EventEmitter(); + @Output() itemDeleted = new EventEmitter(); public displayedColumns = [ 'name', @@ -113,9 +113,11 @@ export class GfBenchmarkComponent implements OnChanges, OnDestroy { } } - public onDeleteWatchlistItem({ dataSource, symbol }: Benchmark) { + public onDeleteItem({ dataSource, symbol }: AssetProfileIdentifier) { this.notificationService.confirm({ - confirmFn: () => this.watchlistItemDeleted.emit({ dataSource, symbol }), + confirmFn: () => { + this.itemDeleted.emit({ dataSource, symbol }); + }, confirmType: ConfirmationDialogType.Warn, title: $localize`Do you really want to delete this item?` });