helper.ts 856 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';

/*
  Generated class for the HelperProvider provider.

  See https://angular.io/guide/dependency-injection for more info on providers
  and Angular DI.
*/
@Injectable()
export class HelperProvider {

13
14
    public static config: object;

15
    constructor(public http: HttpClient) {
16
17
18
19
20
21
22
23
24
25

    }

    initConfig() {
        this.http.get("assets/config.json").subscribe((config: object) => {
            HelperProvider.config = config;
            if (!HelperProvider.config["backendBaseUrl"]) {
                HelperProvider.config["backendBaseUrl"] = location.protocol.concat("//").concat(window.location.hostname).concat(location.port ? `:${location.port}` : "").concat("/").concat(HelperProvider.config["backendProxyURl"]).concat("/");
            }
        });
26
27
    }
}