From c24ac1c18e26b6a24a4d294744908fb0c53ddf3c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 5 May 2017 14:29:58 +0200 Subject: Fix unset video language on video update --- client/src/app/videos/shared/video.service.ts | 5 ++++- client/src/app/videos/video-edit/video-update.component.ts | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'client') diff --git a/client/src/app/videos/shared/video.service.ts b/client/src/app/videos/shared/video.service.ts index ba83c72fd..ef683dea6 100644 --- a/client/src/app/videos/shared/video.service.ts +++ b/client/src/app/videos/shared/video.service.ts @@ -81,14 +81,17 @@ export class VideoService { } updateVideo(video: Video) { + const language = video.language ? video.language : null; + const body = { name: video.name, category: video.category, licence: video.licence, - language: video.language, + language, description: video.description, tags: video.tags }; + const headers = new Headers({ 'Content-Type': 'application/json' }); const options = new RequestOptions({ headers: headers }); diff --git a/client/src/app/videos/video-edit/video-update.component.ts b/client/src/app/videos/video-edit/video-update.component.ts index adb3d295c..933132cc0 100644 --- a/client/src/app/videos/video-edit/video-update.component.ts +++ b/client/src/app/videos/video-edit/video-update.component.ts @@ -98,7 +98,17 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { ); } + checkForm() { + this.forceCheck(); + + return this.form.valid; + } + update() { + if (this.checkForm() === false) { + return; + } + this.video.patch(this.form.value); this.videoService.updateVideo(this.video) -- cgit v1.2.3