diff --git a/src/app/components/representatives/representatives.component.html b/src/app/components/representatives/representatives.component.html index 03b8c12..5a691b7 100644 --- a/src/app/components/representatives/representatives.component.html +++ b/src/app/components/representatives/representatives.component.html @@ -188,26 +188,24 @@ -
+
-
+ @@ -242,7 +240,7 @@
- + --> diff --git a/src/app/services/ninja.service.ts b/src/app/services/ninja.service.ts index a9b55f3..161369c 100644 --- a/src/app/services/ninja.service.ts +++ b/src/app/services/ninja.service.ts @@ -6,8 +6,9 @@ import { UtilService } from './util.service'; @Injectable() export class NinjaService { - // URL to Ninja API - ninjaUrl = 'https://mynano.ninja/api/'; + // URL to MyNanoNinja-compatible representative health check API + // set to empty string to disable + ninjaUrl = ''; // null - loading, false - offline, true - online status = null; @@ -15,6 +16,10 @@ export class NinjaService { constructor(private http: HttpClient, private notifications: NotificationService, private util: UtilService) { } private async request(action): Promise { + if (this.ninjaUrl === '') { + return Promise.resolve(null); + } + return await this.http.get(this.ninjaUrl + action).toPromise() .then(res => { return res; @@ -67,8 +72,14 @@ export class NinjaService { return replist[0]; } - // false - does not exist, null - any other error + // Expected to return: + // false, if the representative never voted as part of nano consensus + // null, if the representative state is unknown (any other error) async getAccount(account: string): Promise { + if (this.ninjaUrl === '') { + return Promise.resolve(null); + } + const REQUEST_TIMEOUT_MS = 10000; const successPromise =