fix(frontend): fixes library health pinging even when the user is not authenticated (#385)
* fix(frontend): library health pings even not authenticated * test * authInitialized guard * subscription
This commit is contained in:
@@ -52,11 +52,19 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
|
||||
if (ready && !this.subscriptionsInitialized) {
|
||||
this.setupWebSocketSubscriptions();
|
||||
this.libraryHealthService.initialize();
|
||||
this.libraryHealthService.initWebsocket();
|
||||
this.subscriptionsInitialized = true;
|
||||
}
|
||||
});
|
||||
|
||||
private readonly authenticatedEffect = effect(() => {
|
||||
const authInitialized = this.authInit.initialized();
|
||||
const isAuthenticated = this.authService.isAuthenticated();
|
||||
if (authInitialized && isAuthenticated) {
|
||||
this.libraryHealthService.fetchHealth();
|
||||
}
|
||||
})
|
||||
|
||||
ngOnInit(): void {
|
||||
window.addEventListener('online', this.onOnline);
|
||||
window.addEventListener('offline', this.onOffline);
|
||||
|
||||
Reference in New Issue
Block a user