@@ -21,7 +21,7 @@ export class FileUploadService {
2121 private http : HttpClient ,
2222 ) { }
2323
24- public uploadFile ( file : File , prefix ?: string , skipInterceptors ?: boolean ) : Observable < HttpResponse < void > | HttpUploadProgressEvent > {
24+ public uploadFile ( file : File , prefix ?: string ) : Observable < HttpResponse < void > | HttpUploadProgressEvent > {
2525 // [
2626 // 'jpg', 'jpeg', 'png', 'gif',
2727 // 'webp', 'apng', 'tif', 'tiff',
@@ -35,7 +35,6 @@ export class FileUploadService {
3535 file . type ,
3636 file ?. name ?. split ( '.' ) ?. slice ( - 1 ) ?. [ 0 ] ?. toLowerCase ( ) || 'jpg' ,
3737 prefix ,
38- skipInterceptors ,
3938 ) . pipe (
4039 concatMap (
4140 ( { data : uploadURLResult } ) =>
@@ -44,7 +43,7 @@ export class FileUploadService {
4443 ) ;
4544 }
4645
47- private getUploadURL ( mimeType : string , extension : string , prefix ?: string , skipInterceptors ?: boolean )
46+ private getUploadURL ( mimeType : string , extension : string , prefix ?: string , )
4847 : Observable < HandledHttpResponse < UploadURLResult > > {
4948 const params : { [ key : string ] : string | number } = {
5049 prefix : prefix ! ,
@@ -56,33 +55,28 @@ export class FileUploadService {
5655 s : `${ Date . now ( ) } ${ Math . floor ( Math . random ( ) * 1000 ) } `
5756 } ;
5857
59- return this . http . get (
60- this . config . getUploadLinkURL ,
61- {
62- params,
63- headers : ! ! skipInterceptors ? { 'skip-interceptors' : "true" } : { } ,
64- }
65- ) . pipe (
66- httpRetry ( ) ,
67- catchError ( ( err : HttpErrorResponse , caught : Observable < { data : UploadURLResult , statusCode : number , message : any ; } > ) => {
68- return of (
69- {
70- statusCode : err ?. status ,
71- message : err ?. error ?. message ?? 'Problem completing this request, please try again' ,
72- data : { } as UploadURLResult ,
73- } ,
74- )
75- } ) ,
76- map < { data : UploadURLResult , statusCode : number , message : any } , HandledHttpResponse < UploadURLResult > > (
77- ( { data : uploadURLResult , statusCode, message } ) => (
78- {
79- data : uploadURLResult ,
80- message,
81- statusCode : statusCode ?? 200 ,
82- }
58+ return this . http . get ( this . config . getUploadLinkURL , { params } )
59+ . pipe (
60+ httpRetry ( ) ,
61+ catchError ( ( err : HttpErrorResponse , caught : Observable < { data : UploadURLResult , statusCode : number , message : any ; } > ) => {
62+ return of (
63+ {
64+ statusCode : err ?. status ,
65+ message : err ?. error ?. message ?? 'Problem completing this request, please try again' ,
66+ data : { } as UploadURLResult ,
67+ } ,
68+ )
69+ } ) ,
70+ map < { data : UploadURLResult , statusCode : number , message : any } , HandledHttpResponse < UploadURLResult > > (
71+ ( { data : uploadURLResult , statusCode, message } ) => (
72+ {
73+ data : uploadURLResult ,
74+ message,
75+ statusCode : statusCode ?? 200 ,
76+ }
77+ ) ,
8378 ) ,
84- ) ,
85- ) ;
79+ ) ;
8680 }
8781
8882 private uploadFileToURL ( uploadFileURL : string , file : File ) : Observable < HttpResponse < void > | HttpUploadProgressEvent > {
0 commit comments