From cea6b51fe36d245658bcaaec6a857f094555dcaf Mon Sep 17 00:00:00 2001 From: Nato Boram Date: Fri, 10 Jul 2020 01:39:09 -0400 Subject: [PATCH] old base logic --- src/app/services/gateway.service.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/app/services/gateway.service.ts b/src/app/services/gateway.service.ts index 485b444..e5a1cc5 100644 --- a/src/app/services/gateway.service.ts +++ b/src/app/services/gateway.service.ts @@ -14,16 +14,11 @@ export class GatewayService { ) { } list(): Observable { - if (environment && environment.base_href !== '/') { - return this.http.get(`${environment.base_href}/assets/json/gateways.json`); - } - - const base = document.querySelector('base'); - if (base) { - return this.http.get(`${base.href}/assets/json/gateways.json`); - } - - throw new Error('Couldn\'t find environment nor base.'); + return this.http.get( + environment.base_href && environment.base_href !== '/' + ? `${environment.base_href}/assets/json/gateways.json` + : `${document.querySelector('base')?.href}assets/json/gateways.json` + ); } get(gateway: string, protocol: Protocol, hashpath: string): Observable> {