diff --git a/frontend/src/app/component/einstellungen/einstellungen.component.ts b/frontend/src/app/component/einstellungen/einstellungen.component.ts index 44d2e8b..57ffbfc 100644 --- a/frontend/src/app/component/einstellungen/einstellungen.component.ts +++ b/frontend/src/app/component/einstellungen/einstellungen.component.ts @@ -16,9 +16,7 @@ export class EinstellungenComponent implements OnInit { icon; - feeds: Observable; - - mySubscription; + feeds: IFeed[]; constructor(private http: HttpClient, private _snackbar: MatSnackBar, @@ -28,17 +26,7 @@ export class EinstellungenComponent implements OnInit { private _router: Router) { this.icon = 'assets/logo.svg'; this._router.routeReuseStrategy.shouldReuseRoute = () => false; - this.mySubscription = this._router.events.subscribe((event) => { - if (event instanceof NavigationEnd) { - // Trick the Router into believing it's last link wasn't previously loaded - this._router.navigated = false; - } - }); - this._feedService.getFeeds().subscribe( - (data: any) => { - this.feeds = data; - } - ); + this._feedService.getFeeds().toPromise().then(data => this.feeds = data).catch(err => this._logger.error(err)); } ngOnInit(): void { @@ -48,12 +36,12 @@ export class EinstellungenComponent implements OnInit { this.http.delete('http://127.0.0.1:8000/feeds/' + id + '/').subscribe( () => { this._snackbar.open('Feed erfolgreich gelöscht!', 'Schließen', {duration: 3000}); + this.feeds = this.feeds.filter(feed => feed.id !== id); }, err => { this._logger.error(err); return throwError(err); } ); - this._router.navigate([this._router.url]); } }