]>
Commit | Line | Data |
---|---|---|
fd206f0b C |
1 | import { HttpClient } from '@angular/common/http' |
2 | import { Injectable } from '@angular/core' | |
3 | import { CustomConfig } from '../../../../../../shared/models/config/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 | } |