]>
Commit | Line | Data |
---|---|---|
db400f44 | 1 | import { catchError } from 'rxjs/operators' |
fd206f0b C |
2 | import { HttpClient } from '@angular/common/http' |
3 | import { Injectable } from '@angular/core' | |
09cababd | 4 | import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model' |
fd206f0b C |
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') | |
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 | } |