aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/video-add
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-07-20 16:24:18 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-07-20 16:25:06 +0200
commitbd5c83a8cb46eb6da2b25df3b1f6a2a5795d1869 (patch)
tree66df283a1554f27b92e392fca36b8e272d7535bc /client/src/app/videos/video-add
parent2f372a865487427ff97ad17edd0e6adfbb478c80 (diff)
downloadPeerTube-bd5c83a8cb46eb6da2b25df3b1f6a2a5795d1869.tar.gz
PeerTube-bd5c83a8cb46eb6da2b25df3b1f6a2a5795d1869.tar.zst
PeerTube-bd5c83a8cb46eb6da2b25df3b1f6a2a5795d1869.zip
Client: Add authHttp service that authentificates the http request and
optionally refresh the access token if needed
Diffstat (limited to 'client/src/app/videos/video-add')
-rw-r--r--client/src/app/videos/video-add/video-add.component.ts18
1 files changed, 16 insertions, 2 deletions
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 342935e36..c0f8cb9c4 100644
--- a/client/src/app/videos/video-add/video-add.component.ts
+++ b/client/src/app/videos/video-add/video-add.component.ts
@@ -130,8 +130,22 @@ export class VideoAddComponent implements OnInit {
130 }; 130 };
131 131
132 item.onError = (response: string, status: number) => { 132 item.onError = (response: string, status: number) => {
133 this.error = (status === 400) ? response : 'Unknow error'; 133 // We need to handle manually these cases beceause we use the FileUpload component
134 console.error(this.error); 134 if (status === 400) {
135 this.error = response;
136 } else if (status === 401) {
137 this.error = 'Access token was expired, refreshing token...';
138 this.authService.refreshAccessToken().subscribe(
139 () => {
140 // Update the uploader request header
141 this.uploader.authToken = this.authService.getRequestHeaderValue();
142 this.error += ' access token refreshed. Please retry your request.';
143 }
144 );
145 } else {
146 this.error = 'Unknow error';
147 console.error(this.error);
148 }
135 }; 149 };
136 150
137 151