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:
NamLe029
2026-04-22 17:27:05 -04:00
committed by Zach Yale
parent 91c19739dc
commit d502c18948
5 changed files with 57 additions and 30 deletions
+9 -1
View File
@@ -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);