aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/video-abuse
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/video-abuse')
-rw-r--r--client/src/app/shared/video-abuse/index.ts4
-rw-r--r--client/src/app/shared/video-abuse/video-abuse.model.ts12
-rw-r--r--client/src/app/shared/video-abuse/video-abuse.service.ts42
3 files changed, 29 insertions, 29 deletions
diff --git a/client/src/app/shared/video-abuse/index.ts b/client/src/app/shared/video-abuse/index.ts
index 563533ba5..7cf24c87d 100644
--- a/client/src/app/shared/video-abuse/index.ts
+++ b/client/src/app/shared/video-abuse/index.ts
@@ -1,2 +1,2 @@
1export * from './video-abuse.service'; 1export * from './video-abuse.service'
2export * from './video-abuse.model'; 2export * from './video-abuse.model'
diff --git a/client/src/app/shared/video-abuse/video-abuse.model.ts b/client/src/app/shared/video-abuse/video-abuse.model.ts
index bb0373027..49c87d6b8 100644
--- a/client/src/app/shared/video-abuse/video-abuse.model.ts
+++ b/client/src/app/shared/video-abuse/video-abuse.model.ts
@@ -1,8 +1,8 @@
1export interface VideoAbuse { 1export interface VideoAbuse {
2 id: string; 2 id: string
3 reason: string; 3 reason: string
4 reporterPodHost: string; 4 reporterPodHost: string
5 reporterUsername: string; 5 reporterUsername: string
6 videoId: string; 6 videoId: string
7 createdAt: Date; 7 createdAt: Date
8} 8}
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}