New frontend config for webserver url to fix static asset httpGet.

Removed "absolute" from config names.
This commit is contained in:
softsimon
2020-11-23 18:22:21 +07:00
parent 2054c951ae
commit 2cbf1474c3
6 changed files with 23 additions and 13 deletions

View File

@@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { shareReplay } from 'rxjs/operators';
import { StateService } from './state.service';
@Injectable({
providedIn: 'root'
@@ -13,9 +14,15 @@ export class AssetsService {
constructor(
private httpClient: HttpClient,
private stateService: StateService,
) {
this.getAssetsJson$ = this.httpClient.get('/resources/assets.json').pipe(shareReplay());
this.getAssetsMinimalJson$ = this.httpClient.get('/resources/assets.minimal.json').pipe(shareReplay());
this.getMiningPools$ = this.httpClient.get('/resources/pools.json').pipe(shareReplay());
let baseApiUrl = '';
if (!this.stateService.isBrowser) {
baseApiUrl = this.stateService.env.STATIC_WEBSERVER_URL;
}
this.getAssetsJson$ = this.httpClient.get(baseApiUrl + '/resources/assets.json').pipe(shareReplay());
this.getAssetsMinimalJson$ = this.httpClient.get(baseApiUrl + '/resources/assets.minimal.json').pipe(shareReplay());
this.getMiningPools$ = this.httpClient.get(baseApiUrl + '/resources/pools.json').pipe(shareReplay());
}
}