diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-09-14 17:06:31 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-09-14 17:25:36 +0200 |
commit | bfb3a98fac582f104c6d9b8b7242ea2cbb650b91 (patch) | |
tree | 24ead7cbbdc785315c406dfba85a55fe5e235d09 /client/src/app/shared | |
parent | d5050d1e097e761685fbaafe6e3d4b8b78d48356 (diff) | |
download | PeerTube-bfb3a98fac582f104c6d9b8b7242ea2cbb650b91.tar.gz PeerTube-bfb3a98fac582f104c6d9b8b7242ea2cbb650b91.tar.zst PeerTube-bfb3a98fac582f104c6d9b8b7242ea2cbb650b91.zip |
Remove ng2 file upload module
Unmaintained and we don't need it anymore with httpclient
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/forms/form-validators/video.ts | 7 | ||||
-rw-r--r-- | client/src/app/shared/rest/rest-extractor.service.ts | 18 | ||||
-rw-r--r-- | client/src/app/shared/shared.module.ts | 4 |
3 files changed, 21 insertions, 8 deletions
diff --git a/client/src/app/shared/forms/form-validators/video.ts b/client/src/app/shared/forms/form-validators/video.ts index 6542cf8f6..32b1f1c2e 100644 --- a/client/src/app/shared/forms/form-validators/video.ts +++ b/client/src/app/shared/forms/form-validators/video.ts | |||
@@ -44,3 +44,10 @@ export const VIDEO_TAGS = { | |||
44 | 'maxlength': 'A tag should be less than 10 characters long.' | 44 | 'maxlength': 'A tag should be less than 10 characters long.' |
45 | } | 45 | } |
46 | } | 46 | } |
47 | |||
48 | export const VIDEO_FILE = { | ||
49 | VALIDATORS: [ Validators.required ], | ||
50 | MESSAGES: { | ||
51 | 'required': 'Video file is required.' | ||
52 | } | ||
53 | } | ||
diff --git a/client/src/app/shared/rest/rest-extractor.service.ts b/client/src/app/shared/rest/rest-extractor.service.ts index 32dad5c73..1f6222da8 100644 --- a/client/src/app/shared/rest/rest-extractor.service.ts +++ b/client/src/app/shared/rest/rest-extractor.service.ts | |||
@@ -40,19 +40,29 @@ export class RestExtractor { | |||
40 | handleError (err: HttpErrorResponse) { | 40 | handleError (err: HttpErrorResponse) { |
41 | let errorMessage | 41 | let errorMessage |
42 | 42 | ||
43 | console.log(err) | ||
44 | |||
43 | if (err.error instanceof Error) { | 45 | if (err.error instanceof Error) { |
44 | // A client-side or network error occurred. Handle it accordingly. | 46 | // A client-side or network error occurred. Handle it accordingly. |
45 | errorMessage = err.error.message | 47 | errorMessage = err.error.message |
46 | console.error('An error occurred:', errorMessage) | 48 | console.error('An error occurred:', errorMessage) |
47 | } else if (err.status !== undefined) { | 49 | } else if (err.status !== undefined) { |
48 | // The backend returned an unsuccessful response code. | 50 | const body = err.error |
49 | // The response body may contain clues as to what went wrong, | 51 | errorMessage = body.error |
50 | errorMessage = err.error | ||
51 | console.error(`Backend returned code ${err.status}, body was: ${errorMessage}`) | 52 | console.error(`Backend returned code ${err.status}, body was: ${errorMessage}`) |
52 | } else { | 53 | } else { |
53 | errorMessage = err | 54 | errorMessage = err |
54 | } | 55 | } |
55 | 56 | ||
56 | return Observable.throw(errorMessage) | 57 | const errorObj = { |
58 | message: errorMessage, | ||
59 | status: undefined | ||
60 | } | ||
61 | |||
62 | if (err.status) { | ||
63 | errorObj.status = err.status | ||
64 | } | ||
65 | |||
66 | return Observable.throw(errorObj) | ||
57 | } | 67 | } |
58 | } | 68 | } |
diff --git a/client/src/app/shared/shared.module.ts b/client/src/app/shared/shared.module.ts index 118ce822d..a28ac322d 100644 --- a/client/src/app/shared/shared.module.ts +++ b/client/src/app/shared/shared.module.ts | |||
@@ -10,7 +10,6 @@ import { BsDropdownModule } from 'ngx-bootstrap/dropdown' | |||
10 | import { ProgressbarModule } from 'ngx-bootstrap/progressbar' | 10 | import { ProgressbarModule } from 'ngx-bootstrap/progressbar' |
11 | import { PaginationModule } from 'ngx-bootstrap/pagination' | 11 | import { PaginationModule } from 'ngx-bootstrap/pagination' |
12 | import { ModalModule } from 'ngx-bootstrap/modal' | 12 | import { ModalModule } from 'ngx-bootstrap/modal' |
13 | import { FileUploadModule } from 'ng2-file-upload/ng2-file-upload' | ||
14 | import { DataTableModule, SharedModule as PrimeSharedModule } from 'primeng/primeng' | 13 | import { DataTableModule, SharedModule as PrimeSharedModule } from 'primeng/primeng' |
15 | 14 | ||
16 | import { AUTH_INTERCEPTOR_PROVIDER } from './auth' | 15 | import { AUTH_INTERCEPTOR_PROVIDER } from './auth' |
@@ -32,8 +31,6 @@ import { VideoAbuseService } from './video-abuse' | |||
32 | PaginationModule.forRoot(), | 31 | PaginationModule.forRoot(), |
33 | ProgressbarModule.forRoot(), | 32 | ProgressbarModule.forRoot(), |
34 | 33 | ||
35 | FileUploadModule, | ||
36 | |||
37 | DataTableModule, | 34 | DataTableModule, |
38 | PrimeSharedModule | 35 | PrimeSharedModule |
39 | ], | 36 | ], |
@@ -52,7 +49,6 @@ import { VideoAbuseService } from './video-abuse' | |||
52 | HttpClientModule, | 49 | HttpClientModule, |
53 | 50 | ||
54 | BsDropdownModule, | 51 | BsDropdownModule, |
55 | FileUploadModule, | ||
56 | ModalModule, | 52 | ModalModule, |
57 | PaginationModule, | 53 | PaginationModule, |
58 | ProgressbarModule, | 54 | ProgressbarModule, |