aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/video/video.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/video/video.service.ts')
-rw-r--r--client/src/app/shared/video/video.service.ts17
1 files changed, 11 insertions, 6 deletions
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index 01d32176b..2e7138cd1 100644
--- a/client/src/app/shared/video/video.service.ts
+++ b/client/src/app/shared/video/video.service.ts
@@ -18,6 +18,7 @@ import { SortField } from './sort-field.type'
18import { VideoDetails } from './video-details.model' 18import { VideoDetails } from './video-details.model'
19import { VideoEdit } from './video-edit.model' 19import { VideoEdit } from './video-edit.model'
20import { Video } from './video.model' 20import { Video } from './video.model'
21import { objectToFormData } from '@app/shared/misc/utils'
21 22
22@Injectable() 23@Injectable()
23export class VideoService { 24export class VideoService {
@@ -46,10 +47,10 @@ export class VideoService {
46 } 47 }
47 48
48 updateVideo (video: VideoEdit) { 49 updateVideo (video: VideoEdit) {
49 const language = video.language || null 50 const language = video.language || undefined
50 const licence = video.licence || null 51 const licence = video.licence || undefined
51 const category = video.category || null 52 const category = video.category || undefined
52 const description = video.description || null 53 const description = video.description || undefined
53 54
54 const body: VideoUpdate = { 55 const body: VideoUpdate = {
55 name: video.name, 56 name: video.name,
@@ -60,10 +61,14 @@ export class VideoService {
60 privacy: video.privacy, 61 privacy: video.privacy,
61 tags: video.tags, 62 tags: video.tags,
62 nsfw: video.nsfw, 63 nsfw: video.nsfw,
63 commentsEnabled: video.commentsEnabled 64 commentsEnabled: video.commentsEnabled,
65 thumbnailfile: video.thumbnailfile,
66 previewfile: video.previewfile
64 } 67 }
65 68
66 return this.authHttp.put(VideoService.BASE_VIDEO_URL + video.id, body) 69 const data = objectToFormData(body)
70
71 return this.authHttp.put(VideoService.BASE_VIDEO_URL + video.id, data)
67 .map(this.restExtractor.extractDataBool) 72 .map(this.restExtractor.extractDataBool)
68 .catch(this.restExtractor.handleError) 73 .catch(this.restExtractor.handleError)
69 } 74 }