diff options
Diffstat (limited to 'client/src/app/core/config/config.service.ts')
-rw-r--r-- | client/src/app/core/config/config.service.ts | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/client/src/app/core/config/config.service.ts b/client/src/app/core/config/config.service.ts new file mode 100644 index 000000000..295e68c36 --- /dev/null +++ b/client/src/app/core/config/config.service.ts | |||
@@ -0,0 +1,36 @@ | |||
1 | import { Injectable } from '@angular/core'; | ||
2 | import { Http } from '@angular/http'; | ||
3 | |||
4 | import { RestExtractor } from '../../shared/rest'; | ||
5 | |||
6 | @Injectable() | ||
7 | export class ConfigService { | ||
8 | private static BASE_CONFIG_URL = '/api/v1/config/'; | ||
9 | |||
10 | private config: { | ||
11 | signup: { | ||
12 | enabled: boolean | ||
13 | } | ||
14 | } = { | ||
15 | signup: { | ||
16 | enabled: false | ||
17 | } | ||
18 | }; | ||
19 | |||
20 | constructor( | ||
21 | private http: Http, | ||
22 | private restExtractor: RestExtractor, | ||
23 | ) {} | ||
24 | |||
25 | loadConfig() { | ||
26 | this.http.get(ConfigService.BASE_CONFIG_URL) | ||
27 | .map(this.restExtractor.extractDataGet) | ||
28 | .subscribe(data => { | ||
29 | this.config = data; | ||
30 | }); | ||
31 | } | ||
32 | |||
33 | getConfig() { | ||
34 | return this.config; | ||
35 | } | ||
36 | } | ||