diff --git a/src/app/app.component.ts b/src/app/app.component.ts index fad0760..3d022f5 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -89,9 +89,7 @@ export class AppComponent implements OnInit { // gets the subscriptions if (this.allowSubscriptions) { - this.postsService.getAllSubscriptions().subscribe(res => { - this.postsService.subscriptions = res['subscriptions']; - }) + this.postsService.reloadSubscriptions(); } } diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts index 34f0794..0665b14 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -458,6 +458,12 @@ export class PostsService implements CanActivate { this.config_reloaded.next(true); } + reloadSubscriptions() { + this.getAllSubscriptions().subscribe(res => { + this.subscriptions = res['subscriptions']; + }); + } + adminExists() { return this.http.post(this.path + 'auth/adminExists', {}, this.httpOptions); } diff --git a/src/app/subscriptions/subscriptions.component.ts b/src/app/subscriptions/subscriptions.component.ts index 1723bfd..97a66be 100644 --- a/src/app/subscriptions/subscriptions.component.ts +++ b/src/app/subscriptions/subscriptions.component.ts @@ -80,6 +80,7 @@ export class SubscriptionsComponent implements OnInit { } else { this.channel_subscriptions.push(result); } + this.postsService.reloadSubscriptions(); } }); } @@ -96,6 +97,7 @@ export class SubscriptionsComponent implements OnInit { if (success) { this.openSnackBar(`${sub.name} successfully deleted!`) this.getSubscriptions(); + this.postsService.reloadSubscriptions(); } }) }