diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-17 10:32:03 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-17 10:41:27 +0100 |
commit | fd206f0b2d7e5c8e00e2817266d90ec54f79e1da (patch) | |
tree | 86b096cf2abd7eb49b892de1c9be855f45a41a9c /client/src/app/+admin/config/shared | |
parent | 9581cabc596acb18c0ad86bcf3a07c2b45e8e47e (diff) | |
download | PeerTube-fd206f0b2d7e5c8e00e2817266d90ec54f79e1da.tar.gz PeerTube-fd206f0b2d7e5c8e00e2817266d90ec54f79e1da.tar.zst PeerTube-fd206f0b2d7e5c8e00e2817266d90ec54f79e1da.zip |
Add ability to update some configuration keys
Diffstat (limited to 'client/src/app/+admin/config/shared')
-rw-r--r-- | client/src/app/+admin/config/shared/config.service.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/client/src/app/+admin/config/shared/config.service.ts b/client/src/app/+admin/config/shared/config.service.ts new file mode 100644 index 000000000..13f1f6cd2 --- /dev/null +++ b/client/src/app/+admin/config/shared/config.service.ts | |||
@@ -0,0 +1,26 @@ | |||
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 | } | ||