diff --git a/src/app/gateway/gateway-table/gateway-table.component.ts b/src/app/gateway/gateway-table/gateway-table.component.ts index e2098dae..f5e05dd6 100644 --- a/src/app/gateway/gateway-table/gateway-table.component.ts +++ b/src/app/gateway/gateway-table/gateway-table.component.ts @@ -43,7 +43,7 @@ export class GatewayTableComponent implements AfterViewInit { faExclamationTriangle = faExclamationTriangle; faCheckCircle = faCheckCircle; - + refetchIntervalId: NodeJS.Timeout; batteryStatusColor = 'green'; batteryStatusPercentage = 50; resultsLength = 0; @@ -67,10 +67,14 @@ export class GatewayTableComponent implements AfterViewInit { this.organizationId = x; this.refresh(); }); - + this.refetchIntervalId = setInterval(() => this.refresh(), 60 * 1000) this.refresh(); } + ngOnDestroy() { + clearInterval(this.refetchIntervalId) + } + private refresh() { this.getGateways().subscribe((data) => { data.result.forEach((gw) => {