Subscriptions are now reloaded on subscribe/unsubscribe in PostsService

pull/209/head
Tzahi12345 5 years ago
parent d7f04fc90a
commit aa0558b770

@ -89,9 +89,7 @@ export class AppComponent implements OnInit {
// gets the subscriptions // gets the subscriptions
if (this.allowSubscriptions) { if (this.allowSubscriptions) {
this.postsService.getAllSubscriptions().subscribe(res => { this.postsService.reloadSubscriptions();
this.postsService.subscriptions = res['subscriptions'];
})
} }
} }

@ -458,6 +458,12 @@ export class PostsService implements CanActivate {
this.config_reloaded.next(true); this.config_reloaded.next(true);
} }
reloadSubscriptions() {
this.getAllSubscriptions().subscribe(res => {
this.subscriptions = res['subscriptions'];
});
}
adminExists() { adminExists() {
return this.http.post(this.path + 'auth/adminExists', {}, this.httpOptions); return this.http.post(this.path + 'auth/adminExists', {}, this.httpOptions);
} }

@ -80,6 +80,7 @@ export class SubscriptionsComponent implements OnInit {
} else { } else {
this.channel_subscriptions.push(result); this.channel_subscriptions.push(result);
} }
this.postsService.reloadSubscriptions();
} }
}); });
} }
@ -96,6 +97,7 @@ export class SubscriptionsComponent implements OnInit {
if (success) { if (success) {
this.openSnackBar(`${sub.name} successfully deleted!`) this.openSnackBar(`${sub.name} successfully deleted!`)
this.getSubscriptions(); this.getSubscriptions();
this.postsService.reloadSubscriptions();
} }
}) })
} }

Loading…
Cancel
Save