aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/video-abuse/video-abuse.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/video-abuse/video-abuse.service.ts')
-rw-r--r--client/src/app/shared/video-abuse/video-abuse.service.ts42
1 files changed, 21 insertions, 21 deletions
diff --git a/client/src/app/shared/video-abuse/video-abuse.service.ts b/client/src/app/shared/video-abuse/video-abuse.service.ts
index da7b2ef8a..4317f9353 100644
--- a/client/src/app/shared/video-abuse/video-abuse.service.ts
+++ b/client/src/app/shared/video-abuse/video-abuse.service.ts
@@ -1,42 +1,42 @@
1import { Injectable } from '@angular/core'; 1import { Injectable } from '@angular/core'
2import { Http } from '@angular/http'; 2import { Http } from '@angular/http'
3import { Observable } from 'rxjs/Observable'; 3import { Observable } from 'rxjs/Observable'
4import 'rxjs/add/operator/catch'; 4import 'rxjs/add/operator/catch'
5import 'rxjs/add/operator/map'; 5import 'rxjs/add/operator/map'
6 6
7import { AuthService } from '../core'; 7import { AuthService } from '../core'
8import { AuthHttp } from '../auth'; 8import { AuthHttp } from '../auth'
9import { RestDataSource, RestExtractor, ResultList } from '../rest'; 9import { RestDataSource, RestExtractor, ResultList } from '../rest'
10import { VideoAbuse } from './video-abuse.model'; 10import { VideoAbuse } from './video-abuse.model'
11 11
12@Injectable() 12@Injectable()
13export class VideoAbuseService { 13export class VideoAbuseService {
14 private static BASE_VIDEO_ABUSE_URL = API_URL + '/api/v1/videos/'; 14 private static BASE_VIDEO_ABUSE_URL = API_URL + '/api/v1/videos/'
15 15
16 constructor( 16 constructor (
17 private authHttp: AuthHttp, 17 private authHttp: AuthHttp,
18 private restExtractor: RestExtractor 18 private restExtractor: RestExtractor
19 ) {} 19 ) {}
20 20
21 getDataSource() { 21 getDataSource () {
22 return new RestDataSource(this.authHttp, VideoAbuseService.BASE_VIDEO_ABUSE_URL + 'abuse'); 22 return new RestDataSource(this.authHttp, VideoAbuseService.BASE_VIDEO_ABUSE_URL + 'abuse')
23 } 23 }
24 24
25 reportVideo(id: string, reason: string) { 25 reportVideo (id: string, reason: string) {
26 const body = { 26 const body = {
27 reason 27 reason
28 }; 28 }
29 const url = VideoAbuseService.BASE_VIDEO_ABUSE_URL + id + '/abuse'; 29 const url = VideoAbuseService.BASE_VIDEO_ABUSE_URL + id + '/abuse'
30 30
31 return this.authHttp.post(url, body) 31 return this.authHttp.post(url, body)
32 .map(this.restExtractor.extractDataBool) 32 .map(this.restExtractor.extractDataBool)
33 .catch((res) => this.restExtractor.handleError(res)); 33 .catch((res) => this.restExtractor.handleError(res))
34 } 34 }
35 35
36 private extractVideoAbuses(result: ResultList) { 36 private extractVideoAbuses (result: ResultList) {
37 const videoAbuses: VideoAbuse[] = result.data; 37 const videoAbuses: VideoAbuse[] = result.data
38 const totalVideoAbuses = result.total; 38 const totalVideoAbuses = result.total
39 39
40 return { videoAbuses, totalVideoAbuses }; 40 return { videoAbuses, totalVideoAbuses }
41 } 41 }
42} 42}