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