diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-03-22 21:15:55 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-03-22 21:25:24 +0100 |
commit | 6e07c3de88791a0b342e0cc319590048117f9c2d (patch) | |
tree | 049f88d3f6d3ec0aeea09702a583deb86d6ef78f /client/src/app/videos/shared/video.service.ts | |
parent | 2d7653dc8726185615bab66353c4e3fb8fbb5a5f (diff) | |
download | PeerTube-6e07c3de88791a0b342e0cc319590048117f9c2d.tar.gz PeerTube-6e07c3de88791a0b342e0cc319590048117f9c2d.tar.zst PeerTube-6e07c3de88791a0b342e0cc319590048117f9c2d.zip |
Add video category support
Diffstat (limited to 'client/src/app/videos/shared/video.service.ts')
-rw-r--r-- | client/src/app/videos/shared/video.service.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/client/src/app/videos/shared/video.service.ts b/client/src/app/videos/shared/video.service.ts index 8bb5a2933..debc114aa 100644 --- a/client/src/app/videos/shared/video.service.ts +++ b/client/src/app/videos/shared/video.service.ts | |||
@@ -22,6 +22,8 @@ import { Video } from './video.model'; | |||
22 | export class VideoService { | 22 | export class VideoService { |
23 | private static BASE_VIDEO_URL = '/api/v1/videos/'; | 23 | private static BASE_VIDEO_URL = '/api/v1/videos/'; |
24 | 24 | ||
25 | videoCategories: Array<{ id: number, label: string }> = []; | ||
26 | |||
25 | constructor( | 27 | constructor( |
26 | private authService: AuthService, | 28 | private authService: AuthService, |
27 | private authHttp: AuthHttp, | 29 | private authHttp: AuthHttp, |
@@ -30,6 +32,19 @@ export class VideoService { | |||
30 | private restService: RestService | 32 | private restService: RestService |
31 | ) {} | 33 | ) {} |
32 | 34 | ||
35 | loadVideoCategories() { | ||
36 | return this.http.get(VideoService.BASE_VIDEO_URL + 'categories') | ||
37 | .map(this.restExtractor.extractDataGet) | ||
38 | .subscribe(data => { | ||
39 | Object.keys(data).forEach(categoryKey => { | ||
40 | this.videoCategories.push({ | ||
41 | id: parseInt(categoryKey), | ||
42 | label: data[categoryKey] | ||
43 | }); | ||
44 | }); | ||
45 | }); | ||
46 | } | ||
47 | |||
33 | getVideo(id: string): Observable<Video> { | 48 | getVideo(id: string): Observable<Video> { |
34 | return this.http.get(VideoService.BASE_VIDEO_URL + id) | 49 | return this.http.get(VideoService.BASE_VIDEO_URL + id) |
35 | .map(this.restExtractor.extractDataGet) | 50 | .map(this.restExtractor.extractDataGet) |