aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/config/config.service.ts
blob: 295e68c36e9105aba5feeca1b7cfce00fac127ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';

import { RestExtractor } from '../../shared/rest';

@Injectable()
export class ConfigService {
  private static BASE_CONFIG_URL = '/api/v1/config/';

  private config: {
    signup: {
      enabled: boolean
    }
  } = {
    signup: {
      enabled: false
    }
  };

  constructor(
    private http: Http,
    private restExtractor: RestExtractor,
  ) {}

  loadConfig() {
    this.http.get(ConfigService.BASE_CONFIG_URL)
             .map(this.restExtractor.extractDataGet)
             .subscribe(data => {
               this.config = data;
             });
  }

  getConfig() {
    return this.config;
  }
}