old base logic

merge-requests/3/merge
Nato Boram 2020-07-10 01:39:09 -04:00
parent bc40b43479
commit cea6b51fe3
No known key found for this signature in database
GPG Key ID: 478E3C64BF88AFFA
1 changed files with 5 additions and 10 deletions

View File

@ -14,16 +14,11 @@ export class GatewayService {
) { } ) { }
list(): Observable<string[]> { list(): Observable<string[]> {
if (environment && environment.base_href !== '/') { return this.http.get<string[]>(
return this.http.get<string[]>(`${environment.base_href}/assets/json/gateways.json`); environment.base_href && environment.base_href !== '/'
} ? `${environment.base_href}/assets/json/gateways.json`
: `${document.querySelector('base')?.href}assets/json/gateways.json`
const base = document.querySelector('base'); );
if (base) {
return this.http.get<string[]>(`${base.href}/assets/json/gateways.json`);
}
throw new Error('Couldn\'t find environment nor base.');
} }
get(gateway: string, protocol: Protocol, hashpath: string): Observable<HttpResponse<string>> { get(gateway: string, protocol: Protocol, hashpath: string): Observable<HttpResponse<string>> {