Stop making unnecessary calls to the update service

pull/1805/head
Jamie 7 years ago
parent 677accf5d7
commit 52a22b3a60

@ -21,6 +21,8 @@ export class AppComponent implements OnInit {
public updateAvailable: boolean; public updateAvailable: boolean;
public currentUrl: string; public currentUrl: string;
private checkedForUpdate: boolean;
constructor(public notificationService: NotificationService, constructor(public notificationService: NotificationService,
public authService: AuthService, public authService: AuthService,
private readonly router: Router, private readonly router: Router,
@ -47,7 +49,8 @@ export class AppComponent implements OnInit {
this.user = this.authService.claims(); this.user = this.authService.claims();
this.showNav = this.authService.loggedIn(); this.showNav = this.authService.loggedIn();
if (this.user !== null && this.user.name) { if (this.user !== null && this.user.name && !this.checkedForUpdate) {
this.checkedForUpdate = true;
this.jobService.getCachedUpdate().subscribe(x => { this.jobService.getCachedUpdate().subscribe(x => {
this.updateAvailable = x; this.updateAvailable = x;
}); });

Loading…
Cancel
Save