aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/angular/videos/components/add
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-04-14 22:07:46 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-04-14 22:07:46 +0200
commit1553e15d82b8a1ec4967a90d43b33274f8215c44 (patch)
treeee53fdbb32895153a1fd2470e1c51cf1d9a38e77 /client/angular/videos/components/add
parent0c1cbbfe29d91c95f9c574b57adf067654b8b5b4 (diff)
downloadPeerTube-1553e15d82b8a1ec4967a90d43b33274f8215c44.tar.gz
PeerTube-1553e15d82b8a1ec4967a90d43b33274f8215c44.tar.zst
PeerTube-1553e15d82b8a1ec4967a90d43b33274f8215c44.zip
Implement user requests autorizations in the client side
Diffstat (limited to 'client/angular/videos/components/add')
-rw-r--r--client/angular/videos/components/add/videos-add.component.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/client/angular/videos/components/add/videos-add.component.ts b/client/angular/videos/components/add/videos-add.component.ts
index 7ae11db22..bc7b4057c 100644
--- a/client/angular/videos/components/add/videos-add.component.ts
+++ b/client/angular/videos/components/add/videos-add.component.ts
@@ -1,6 +1,9 @@
1import { Component, ElementRef, OnInit } from 'angular2/core'; 1import { Component, ElementRef, OnInit } from 'angular2/core';
2import { Router } from 'angular2/router'; 2import { Router } from 'angular2/router';
3 3
4import { AuthService } from '../../../users/services/auth.service';
5import { User } from '../../../users/models/user';
6
4// TODO: import it with systemjs 7// TODO: import it with systemjs
5declare var jQuery:any; 8declare var jQuery:any;
6 9
@@ -11,14 +14,19 @@ declare var jQuery:any;
11}) 14})
12 15
13export class VideosAddComponent implements OnInit { 16export class VideosAddComponent implements OnInit {
17 user: User;
14 fileToUpload: any; 18 fileToUpload: any;
15 progressBar: { value: number; max: number; } = { value: 0, max: 0 }; 19 progressBar: { value: number; max: number; } = { value: 0, max: 0 };
16 20
17 private _form: any; 21 private _form: any;
18 22
19 constructor(private _router: Router, private _elementRef: ElementRef) {} 23 constructor(
24 private _router: Router, private _elementRef: ElementRef,
25 private _authService: AuthService
26 ) {}
20 27
21 ngOnInit() { 28 ngOnInit() {
29 this.user = User.load();
22 jQuery(this._elementRef.nativeElement).find('#videofile').fileupload({ 30 jQuery(this._elementRef.nativeElement).find('#videofile').fileupload({
23 url: '/api/v1/videos', 31 url: '/api/v1/videos',
24 dataType: 'json', 32 dataType: 'json',
@@ -49,6 +57,7 @@ export class VideosAddComponent implements OnInit {
49 } 57 }
50 58
51 uploadFile() { 59 uploadFile() {
60 this._form.headers = this._authService.getRequestHeader().toJSON();
52 this._form.formData = jQuery(this._elementRef.nativeElement).find('form').serializeArray(); 61 this._form.formData = jQuery(this._elementRef.nativeElement).find('form').serializeArray();
53 this._form.submit(); 62 this._form.submit();
54 } 63 }