]>
Commit | Line | Data |
---|---|---|
df98563e C |
1 | import { Injectable } from '@angular/core' |
2 | import { Http } from '@angular/http' | |
92fb909c | 3 | |
df98563e | 4 | import { RestExtractor } from '../../shared/rest' |
92fb909c C |
5 | |
6 | @Injectable() | |
7 | export class ConfigService { | |
df98563e | 8 | private static BASE_CONFIG_URL = API_URL + '/api/v1/config/' |
92fb909c C |
9 | |
10 | private config: { | |
11 | signup: { | |
12 | enabled: boolean | |
13 | } | |
14 | } = { | |
15 | signup: { | |
16 | enabled: false | |
17 | } | |
df98563e | 18 | } |
92fb909c | 19 | |
df98563e | 20 | constructor ( |
92fb909c | 21 | private http: Http, |
df98563e | 22 | private restExtractor: RestExtractor |
92fb909c C |
23 | ) {} |
24 | ||
df98563e | 25 | loadConfig () { |
92fb909c C |
26 | this.http.get(ConfigService.BASE_CONFIG_URL) |
27 | .map(this.restExtractor.extractDataGet) | |
28 | .subscribe(data => { | |
df98563e C |
29 | this.config = data |
30 | }) | |
92fb909c C |
31 | } |
32 | ||
df98563e C |
33 | getConfig () { |
34 | return this.config | |
92fb909c C |
35 | } |
36 | } |