import { VideoDetails } from './video-details.model'
import { VideoEdit } from './video-edit.model'
import { Video } from './video.model'
+import { objectToFormData } from '@app/shared/misc/utils'
@Injectable()
export class VideoService {
}
updateVideo (video: VideoEdit) {
- const language = video.language || null
- const licence = video.licence || null
- const category = video.category || null
- const description = video.description || null
+ const language = video.language || undefined
+ const licence = video.licence || undefined
+ const category = video.category || undefined
+ const description = video.description || undefined
const body: VideoUpdate = {
name: video.name,
privacy: video.privacy,
tags: video.tags,
nsfw: video.nsfw,
- commentsEnabled: video.commentsEnabled
+ commentsEnabled: video.commentsEnabled,
+ thumbnailfile: video.thumbnailfile,
+ previewfile: video.previewfile
}
- return this.authHttp.put(VideoService.BASE_VIDEO_URL + video.id, body)
+ const data = objectToFormData(body)
+
+ return this.authHttp.put(VideoService.BASE_VIDEO_URL + video.id, data)
.map(this.restExtractor.extractDataBool)
.catch(this.restExtractor.handleError)
}