Update Angular
+ Add a config file to use Docker
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { Injector } from '@angular/core';
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
|
||||
import { ConfigurationHelper } from './configuration-helper';
|
||||
@@ -10,12 +9,14 @@ export class BaseService {
|
||||
constructor() {
|
||||
ConfigurationHelper.settings.subscribe(settings =>
|
||||
{
|
||||
let tmpApiUrl : string = settings.apiUrl;
|
||||
|
||||
this.headers = new HttpHeaders({
|
||||
'Access-Control-Allow-Origin': tmpApiUrl
|
||||
});
|
||||
this.apiUrl = tmpApiUrl + '/api';
|
||||
if (settings != null) {
|
||||
let tmpApiUrl : string = settings.apiUrl;
|
||||
|
||||
this.headers = new HttpHeaders({
|
||||
'Access-Control-Allow-Origin': tmpApiUrl
|
||||
});
|
||||
this.apiUrl = tmpApiUrl + '/api';
|
||||
}
|
||||
});
|
||||
|
||||
// const config: ConfigurationHelper = injector.get(ConfigurationHelper);
|
||||
|
||||
@@ -8,7 +8,7 @@ import { IAppSettings } from '../models/app-settings';
|
||||
|
||||
@Injectable({ providedIn: "root" })
|
||||
export class ConfigurationHelper {
|
||||
private static settingsSource = new BehaviorSubject<IAppSettings>();
|
||||
private static settingsSource = new BehaviorSubject<IAppSettings>(null);
|
||||
public static settings = ConfigurationHelper.settingsSource.asObservable();
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
@@ -20,7 +20,6 @@ export class ConfigurationHelper {
|
||||
this.http.get(jsonFile)
|
||||
.toPromise()
|
||||
.then((response : IAppSettings) => {
|
||||
//ConfigurationHelper.settings = <IAppSettings>response;
|
||||
ConfigurationHelper.settingsSource.next(<IAppSettings>response);
|
||||
resolve();
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user