From db7af09bd8e9de57cdda88c2e32387551235b3a4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 9 Oct 2017 19:12:40 +0200 Subject: Client: fix loading server configurations --- client/src/app/videos/shared/video.service.ts | 32 +-------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) (limited to 'client/src/app/videos/shared') diff --git a/client/src/app/videos/shared/video.service.ts b/client/src/app/videos/shared/video.service.ts index cfce4cb16..037c20416 100644 --- a/client/src/app/videos/shared/video.service.ts +++ b/client/src/app/videos/shared/video.service.ts @@ -14,7 +14,6 @@ import { import { Video } from './video.model' import { VideoPagination } from './video-pagination.model' import { - VideoCreate, UserVideoRate, VideoRateType, VideoUpdate, @@ -28,28 +27,12 @@ import { export class VideoService { private static BASE_VIDEO_URL = API_URL + '/api/v1/videos/' - videoCategories: Array<{ id: number, label: string }> = [] - videoLicences: Array<{ id: number, label: string }> = [] - videoLanguages: Array<{ id: number, label: string }> = [] - constructor ( private authHttp: HttpClient, private restExtractor: RestExtractor, private restService: RestService ) {} - loadVideoCategories () { - return this.loadVideoAttributeEnum('categories', this.videoCategories) - } - - loadVideoLicences () { - return this.loadVideoAttributeEnum('licences', this.videoLicences) - } - - loadVideoLanguages () { - return this.loadVideoAttributeEnum('languages', this.videoLanguages) - } - getVideo (uuid: string) { return this.authHttp.get(VideoService.BASE_VIDEO_URL + uuid) .map(videoHash => new Video(videoHash)) @@ -74,8 +57,7 @@ export class VideoService { .catch(this.restExtractor.handleError) } - // uploadVideo (video: VideoCreate) { - uploadVideo (video: any) { + uploadVideo (video: FormData) { const req = new HttpRequest('POST', `${VideoService.BASE_VIDEO_URL}/upload`, video, { reportProgress: true }) return this.authHttp.request(req) @@ -175,16 +157,4 @@ export class VideoService { return { videos, totalVideos } } - - private loadVideoAttributeEnum (attributeName: 'categories' | 'licences' | 'languages', hashToPopulate: { id: number, label: string }[]) { - return this.authHttp.get(VideoService.BASE_VIDEO_URL + attributeName) - .subscribe(data => { - Object.keys(data).forEach(dataKey => { - hashToPopulate.push({ - id: parseInt(dataKey, 10), - label: data[dataKey] - }) - }) - }) - } } -- cgit v1.2.3