@@ -21,7 +21,7 @@ export class FileUploadService {
2121 private http : HttpClient ,
2222 ) { }
2323
24- public uploadFile ( file : File , prefix ?: string ) : Observable < HttpResponse < void > | HttpUploadProgressEvent > {
24+ public uploadFile ( file : File , prefix ?: string , skipInterceptors ?: boolean ) : Observable < HttpResponse < void > | HttpUploadProgressEvent > {
2525 // [
2626 // 'jpg', 'jpeg', 'png', 'gif',
2727 // 'webp', 'apng', 'tif', 'tiff',
@@ -35,6 +35,7 @@ export class FileUploadService {
3535 file . type ,
3636 file ?. name ?. split ( '.' ) ?. slice ( - 1 ) ?. [ 0 ] ?. toLowerCase ( ) || 'jpg' ,
3737 prefix ,
38+ skipInterceptors ,
3839 ) . pipe (
3940 concatMap (
4041 ( { data : uploadURLResult } ) =>
@@ -43,7 +44,7 @@ export class FileUploadService {
4344 ) ;
4445 }
4546
46- private getUploadURL ( mimeType : string , extension : string , prefix ?: string , )
47+ private getUploadURL ( mimeType : string , extension : string , prefix ?: string , skipInterceptors ?: boolean )
4748 : Observable < HandledHttpResponse < UploadURLResult > > {
4849 const params : { [ key : string ] : string | number } = {
4950 prefix : prefix ! ,
@@ -55,28 +56,33 @@ export class FileUploadService {
5556 s : `${ Date . now ( ) } ${ Math . floor ( Math . random ( ) * 1000 ) } `
5657 } ;
5758
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- ) ,
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+ }
7883 ) ,
79- ) ;
84+ ) ,
85+ ) ;
8086 }
8187
8288 private uploadFileToURL ( uploadFileURL : string , file : File ) : Observable < HttpResponse < void > | HttpUploadProgressEvent > {
0 commit comments