fix issue where more than one api call was made on every route change

This commit is contained in:
Art Lowel
2023-09-22 10:23:07 +02:00
parent 404ccd9b0e
commit 5ad621b27e
7 changed files with 174 additions and 71 deletions

View File

@@ -32,6 +32,7 @@ import { logStartupMessage } from '../../../startup-message';
import { MenuService } from '../../app/shared/menu/menu.service';
import { RootDataService } from '../../app/core/data/root-data.service';
import { firstValueFrom, Subscription } from 'rxjs';
import { ServerCheckGuard } from '../../app/core/server-check/server-check.guard';
/**
* Performs client-side initialization.
@@ -56,7 +57,8 @@ export class BrowserInitService extends InitService {
protected authService: AuthService,
protected themeService: ThemeService,
protected menuService: MenuService,
private rootDataService: RootDataService
private rootDataService: RootDataService,
protected serverCheckGuard: ServerCheckGuard,
) {
super(
store,
@@ -172,4 +174,13 @@ export class BrowserInitService extends InitService {
});
}
/**
* Start route-listening subscriptions
* @protected
*/
protected initRouteListeners(): void {
super.initRouteListeners();
this.serverCheckGuard.listenForRouteChanges();
}
}