aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/follows/shared/redundancy.service.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-11 16:27:07 +0200
committerChocobozzz <me@florianbigard.com>2018-09-13 14:05:49 +0200
commitc48e82b5e0478434de30626d14594a97f2402e7c (patch)
treea78e5272bd0fe4f5b41831e571e02d05f1515b82 /client/src/app/+admin/follows/shared/redundancy.service.ts
parenta651038487faa838bda3ce04695b08bc65baff70 (diff)
downloadPeerTube-c48e82b5e0478434de30626d14594a97f2402e7c.tar.gz
PeerTube-c48e82b5e0478434de30626d14594a97f2402e7c.tar.zst
PeerTube-c48e82b5e0478434de30626d14594a97f2402e7c.zip
Basic video redundancy implementation
Diffstat (limited to 'client/src/app/+admin/follows/shared/redundancy.service.ts')
-rw-r--r--client/src/app/+admin/follows/shared/redundancy.service.ts29
1 files changed, 29 insertions, 0 deletions
diff --git a/client/src/app/+admin/follows/shared/redundancy.service.ts b/client/src/app/+admin/follows/shared/redundancy.service.ts
new file mode 100644
index 000000000..96b29faab
--- /dev/null
+++ b/client/src/app/+admin/follows/shared/redundancy.service.ts
@@ -0,0 +1,29 @@
1import { catchError, map } from 'rxjs/operators'
2import { HttpClient } from '@angular/common/http'
3import { Injectable } from '@angular/core'
4import { RestExtractor, RestService } from '@app/shared'
5import { environment } from '../../../../environments/environment'
6
7@Injectable()
8export class RedundancyService {
9 static BASE_USER_SUBSCRIPTIONS_URL = environment.apiUrl + '/api/v1/server/redundancy'
10
11 constructor (
12 private authHttp: HttpClient,
13 private restExtractor: RestExtractor,
14 private restService: RestService
15 ) { }
16
17 updateRedundancy (host: string, redundancyAllowed: boolean) {
18 const url = RedundancyService.BASE_USER_SUBSCRIPTIONS_URL + '/' + host
19
20 const body = { redundancyAllowed }
21
22 return this.authHttp.put(url, body)
23 .pipe(
24 map(this.restExtractor.extractDataBool),
25 catchError(err => this.restExtractor.handleError(err))
26 )
27 }
28
29}