Update to have a configuration file out of the
app bundle.
This commit is contained in:
@@ -1,18 +1,32 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injector } from '@angular/core';
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
import { environment } from '../environments/environment';
|
||||
|
||||
import { ConfigurationHelper } from './configuration-helper';
|
||||
|
||||
@Injectable()
|
||||
export class BaseService {
|
||||
protected readonly headers: HttpHeaders;
|
||||
protected readonly apiUrl: string;
|
||||
protected headers: HttpHeaders;
|
||||
protected apiUrl: string;
|
||||
|
||||
constructor() {
|
||||
this.headers = new HttpHeaders({
|
||||
'Access-Control-Allow-Origin': environment.apiUrl
|
||||
ConfigurationHelper.settings.subscribe(settings =>
|
||||
{
|
||||
let tmpApiUrl : string = settings.apiUrl;
|
||||
|
||||
this.headers = new HttpHeaders({
|
||||
'Access-Control-Allow-Origin': tmpApiUrl
|
||||
});
|
||||
this.apiUrl = tmpApiUrl + '/api';
|
||||
});
|
||||
|
||||
this.apiUrl = environment.apiUrl + '/api';
|
||||
// const config: ConfigurationHelper = injector.get(ConfigurationHelper);
|
||||
// config.load(environment.env)
|
||||
// .then(() => {
|
||||
// let tmpApiUrl : string = ConfigurationHelper.settings.apiUrl;
|
||||
|
||||
// this.headers = new HttpHeaders({
|
||||
// 'Access-Control-Allow-Origin': tmpApiUrl
|
||||
// });
|
||||
// this.apiUrl = tmpApiUrl + '/api';
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user