aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/shared
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/videos/shared')
-rw-r--r--client/src/app/videos/shared/video.model.ts3
-rw-r--r--client/src/app/videos/shared/video.service.ts15
2 files changed, 18 insertions, 0 deletions
diff --git a/client/src/app/videos/shared/video.model.ts b/client/src/app/videos/shared/video.model.ts
index 3eef936eb..b5d96f63a 100644
--- a/client/src/app/videos/shared/video.model.ts
+++ b/client/src/app/videos/shared/video.model.ts
@@ -2,6 +2,7 @@ export class Video {
2 author: string; 2 author: string;
3 by: string; 3 by: string;
4 createdAt: Date; 4 createdAt: Date;
5 categoryLabel: string;
5 description: string; 6 description: string;
6 duration: string; 7 duration: string;
7 id: string; 8 id: string;
@@ -31,6 +32,7 @@ export class Video {
31 constructor(hash: { 32 constructor(hash: {
32 author: string, 33 author: string,
33 createdAt: string, 34 createdAt: string,
35 categoryLabel: string,
34 description: string, 36 description: string,
35 duration: number; 37 duration: number;
36 id: string, 38 id: string,
@@ -46,6 +48,7 @@ export class Video {
46 }) { 48 }) {
47 this.author = hash.author; 49 this.author = hash.author;
48 this.createdAt = new Date(hash.createdAt); 50 this.createdAt = new Date(hash.createdAt);
51 this.categoryLabel = hash.categoryLabel;
49 this.description = hash.description; 52 this.description = hash.description;
50 this.duration = Video.createDurationString(hash.duration); 53 this.duration = Video.createDurationString(hash.duration);
51 this.id = hash.id; 54 this.id = hash.id;
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';
22export class VideoService { 22export 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)