]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/core/config/config.service.ts
Add ability to limit user registrations
[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 import { ServerConfig } from '../../../../../shared'
6
7 @Injectable()
8 export class ConfigService {
9 private static BASE_CONFIG_URL = API_URL + '/api/v1/config/'
10
11 private config: ServerConfig = {
12 signup: {
13 allowed: false
14 }
15 }
16
17 constructor (
18 private http: Http,
19 private restExtractor: RestExtractor
20 ) {}
21
22 loadConfig () {
23 this.http.get(ConfigService.BASE_CONFIG_URL)
24 .map(this.restExtractor.extractDataGet)
25 .subscribe(data => {
26 this.config = data
27 })
28 }
29
30 getConfig () {
31 return this.config
32 }
33 }