]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/+admin/config/shared/config.service.ts
Add stats route
[github/Chocobozzz/PeerTube.git] / client / src / app / +admin / config / shared / config.service.ts
1 import { HttpClient } from '@angular/common/http'
2 import { Injectable } from '@angular/core'
3 import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model'
4 import { environment } from '../../../../environments/environment'
5 import { RestExtractor, RestService } from '../../../shared'
6
7 @Injectable()
8 export class ConfigService {
9 private static BASE_APPLICATION_URL = environment.apiUrl + '/api/v1/config'
10
11 constructor (
12 private authHttp: HttpClient,
13 private restService: RestService,
14 private restExtractor: RestExtractor
15 ) {}
16
17 getCustomConfig () {
18 return this.authHttp.get<CustomConfig>(ConfigService.BASE_APPLICATION_URL + '/custom')
19 .catch(res => this.restExtractor.handleError(res))
20 }
21
22 updateCustomConfig (data: CustomConfig) {
23 return this.authHttp.put<CustomConfig>(ConfigService.BASE_APPLICATION_URL + '/custom', data)
24 .catch(res => this.restExtractor.handleError(res))
25 }
26 }