]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/core/config/config.service.ts
Client: Handle NSFW video
[github/Chocobozzz/PeerTube.git] / client / src / app / core / config / config.service.ts
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 }