diff options
Diffstat (limited to 'client/src/app/+admin/follows/shared/redundancy.service.ts')
-rw-r--r-- | client/src/app/+admin/follows/shared/redundancy.service.ts | 29 |
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 @@ | |||
1 | import { catchError, map } from 'rxjs/operators' | ||
2 | import { HttpClient } from '@angular/common/http' | ||
3 | import { Injectable } from '@angular/core' | ||
4 | import { RestExtractor, RestService } from '@app/shared' | ||
5 | import { environment } from '../../../../environments/environment' | ||
6 | |||
7 | @Injectable() | ||
8 | export 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 | } | ||