]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/core/config/config.service.ts
Share models between server and client
[github/Chocobozzz/PeerTube.git] / client / src / app / core / config / config.service.ts
index 407dca0835a9be00ac43dc246613394191a467b8..b8cb15e84b8538fc7d3890e2adf0ac53f15c317f 100644 (file)
@@ -1,36 +1,33 @@
-import { Injectable } from '@angular/core';
-import { Http } from '@angular/http';
+import { Injectable } from '@angular/core'
+import { Http } from '@angular/http'
 
-import { RestExtractor } from '../../shared/rest';
+import { RestExtractor } from '../../shared/rest'
+import { ServerConfig } from '../../../../../shared'
 
 @Injectable()
 export class ConfigService {
-  private static BASE_CONFIG_URL = API_URL + '/api/v1/config/';
+  private static BASE_CONFIG_URL = API_URL + '/api/v1/config/'
 
-  private config: {
-    signup: {
-      enabled: boolean
-    }
-  } = {
+  private config: ServerConfig = {
     signup: {
       enabled: false
     }
-  };
+  }
 
-  constructor(
+  constructor (
     private http: Http,
-    private restExtractor: RestExtractor,
+    private restExtractor: RestExtractor
   ) {}
 
-  loadConfig() {
+  loadConfig () {
     this.http.get(ConfigService.BASE_CONFIG_URL)
              .map(this.restExtractor.extractDataGet)
              .subscribe(data => {
-               this.config = data;
-             });
+               this.config = data
+             })
   }
 
-  getConfig() {
-    return this.config;
+  getConfig () {
+    return this.config
   }
 }