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
if (this.allowSubscriptions) {
this.postsService.getAllSubscriptions().subscribe(res => {
this.postsService.subscriptions = res['subscriptions'];
})
this.postsService.reloadSubscriptions();
}
}

@ -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);
}

@ -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();
}
})
}

Loading…
Cancel
Save