]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/+admin/config/shared/config.service.ts
autofocus first field on login
[github/Chocobozzz/PeerTube.git] / client / src / app / +admin / config / shared / config.service.ts
CommitLineData
db400f44 1import { catchError } from 'rxjs/operators'
fd206f0b
C
2import { HttpClient } from '@angular/common/http'
3import { Injectable } from '@angular/core'
09cababd 4import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model'
fd206f0b
C
5import { environment } from '../../../../environments/environment'
6import { RestExtractor, RestService } from '../../../shared'
7
8@Injectable()
9export 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')
db400f44 20 .pipe(catchError(res => this.restExtractor.handleError(res)))
fd206f0b
C
21 }
22
23 updateCustomConfig (data: CustomConfig) {
24 return this.authHttp.put<CustomConfig>(ConfigService.BASE_APPLICATION_URL + '/custom', data)
db400f44 25 .pipe(catchError(res => this.restExtractor.handleError(res)))
fd206f0b
C
26 }
27}