aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/forms/form-validators/video.ts7
-rw-r--r--client/src/app/shared/rest/rest-extractor.service.ts18
-rw-r--r--client/src/app/shared/shared.module.ts4
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
48export 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'
10import { ProgressbarModule } from 'ngx-bootstrap/progressbar' 10import { ProgressbarModule } from 'ngx-bootstrap/progressbar'
11import { PaginationModule } from 'ngx-bootstrap/pagination' 11import { PaginationModule } from 'ngx-bootstrap/pagination'
12import { ModalModule } from 'ngx-bootstrap/modal' 12import { ModalModule } from 'ngx-bootstrap/modal'
13import { FileUploadModule } from 'ng2-file-upload/ng2-file-upload'
14import { DataTableModule, SharedModule as PrimeSharedModule } from 'primeng/primeng' 13import { DataTableModule, SharedModule as PrimeSharedModule } from 'primeng/primeng'
15 14
16import { AUTH_INTERCEPTOR_PROVIDER } from './auth' 15import { 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,