Only on change
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
@@ -2,6 +2,7 @@ import { Component, OnInit, OnDestroy, Inject, ViewEncapsulation, RendererFactor
|
||||
import { Router, NavigationStart, NavigationEnd, RouteConfigLoadStart, RouteConfigLoadEnd, ActivatedRoute, PRIMARY_OUTLET } from '@angular/router';
|
||||
import { Meta, Title, MetaDefinition } from '@angular/platform-browser';import { DOCUMENT } from "@angular/common";
|
||||
import { Subscription , Observable } from 'rxjs';
|
||||
import { distinctUntilChanged} from 'rxjs/operators';
|
||||
import { Store, Action } from '@ngrx/store';
|
||||
import { IUser } from '../../models/user';
|
||||
|
||||
@@ -51,11 +52,11 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
) {
|
||||
|
||||
//check health every 30 seconds
|
||||
this.healthCheckService.check(30000).subscribe((online) => {
|
||||
this.healthCheckService.check(30000).pipe(distinctUntilChanged()).subscribe((online) => {
|
||||
if(online) {
|
||||
this.store.dispatch(new commonActions.Online());
|
||||
this.store.dispatch(new commonActions.Online());
|
||||
} else {
|
||||
this.store.dispatch(new commonActions.Offline());
|
||||
this.store.dispatch(new commonActions.Offline());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user