X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fvideos%2Fvideo-add%2Fvideo-add.component.ts;h=144879a54c9d2c15704388388bfc02c6585b22e4;hb=1cdb5c0f582502eac4d851cecc015e81cf16316b;hp=8df4f951be603322bc516e3ebc105cf8cd309976;hpb=fe3b20cdaf54125674afd3c3d0aa8e9411bb0722;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/videos/video-add/video-add.component.ts b/client/src/app/videos/video-add/video-add.component.ts index 8df4f951b..144879a54 100644 --- a/client/src/app/videos/video-add/video-add.component.ts +++ b/client/src/app/videos/video-add/video-add.component.ts @@ -18,6 +18,7 @@ import { AuthService, User } from '../../shared'; }) export class VideoAddComponent implements OnInit { + error: string = null; fileToUpload: any; progressBar: { value: number; max: number; } = { value: 0, max: 0 }; user: User; @@ -57,11 +58,23 @@ export class VideoAddComponent implements OnInit { // Print all the videos once it's finished this.router.navigate(['VideosList']); + }, + + fail: (e, data) => { + const xhr = data.jqXHR; + if (xhr.status === 400) { + this.error = xhr.responseText; + } else { + this.error = 'Unknow error'; + } + + console.error(data); } }); } uploadFile() { + this.error = null; this.form.formData = jQuery(this.elementRef.nativeElement).find('form').serializeArray(); this.form.headers = this.authService.getRequestHeader().toJSON(); this.form.submit();