From 90c39de0ccb03fc913bf71a4146bf7276459cbef Mon Sep 17 00:00:00 2001 From: Jesse Lucas Date: Tue, 17 Mar 2020 22:36:42 -0400 Subject: [PATCH] add system config service retry --- src/app/system-config.service.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/app/system-config.service.ts b/src/app/system-config.service.ts index c4bdd7f64..0cc98d80f 100644 --- a/src/app/system-config.service.ts +++ b/src/app/system-config.service.ts @@ -2,13 +2,13 @@ import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable, Subject } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { map, retry } from 'rxjs/operators'; import { Folder } from './folder'; import { Device } from './device'; import { CookieService } from './cookie.service'; import { environment } from '../environments/environment' -import { apiURL } from './api-utils' +import { apiURL, apiRetry } from './api-utils' @Injectable({ providedIn: 'root' @@ -31,14 +31,16 @@ export class SystemConfigService { getSystemConfig(): Observable { return this.http .get(this.systemConfigUrl, this.httpOptions) - .pipe(map(res => { - this.folders = res['folders']; - this.devices = res['devices']; - this.foldersSubject.next(this.folders); - this.devicesSubject.next(this.devices); + .pipe( + retry(apiRetry), + map(res => { + this.folders = res['folders']; + this.devices = res['devices']; + this.foldersSubject.next(this.folders); + this.devicesSubject.next(this.devices); - return res; - }) + return res; + }) ); }