From fc4888c6e2d4a0d0bd22f871b1399469c688ba87 Mon Sep 17 00:00:00 2001 From: Timo Bejan Date: Mon, 19 Oct 2020 11:24:10 +0300 Subject: [PATCH] fixed wrongly generated http calls --- .../file-preview-screen.component.ts | 1 + .../file/pdf-viewer/pdf-viewer.component.ts | 3 +++ .../src/lib/api/fileUploadController.service.ts | 15 ++++++++++----- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts index 024a54c5b..56a9b3d12 100644 --- a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts @@ -112,6 +112,7 @@ export class FilePreviewScreenComponent implements OnInit { } public fileReady(viewer: string) { + console.log('ready' , viewer); this._readyViewers.push(viewer); this._changeDetectorRef.detectChanges(); } diff --git a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts index 28e857b12..4d8ec5b40 100644 --- a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts +++ b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts @@ -49,10 +49,12 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnDestroy { } ngOnInit() { + console.log('init viewer'); this.wvDocumentLoadedHandler = this.wvDocumentLoadedHandler.bind(this); } wvDocumentLoadedHandler(): void { + console.log('loaded'); this.wvInstance.setFitMode('FitPage'); this.fileReady.emit(); } @@ -61,6 +63,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnDestroy { this._fileDownloadService.loadFile(this.fileType, this.fileId, (data) => { this._fileData = data }, () => this._fileData).subscribe(() => { + console.log('load viewer'); this._loadViewer(this._fileData); }) } diff --git a/libs/red-ui-http/src/lib/api/fileUploadController.service.ts b/libs/red-ui-http/src/lib/api/fileUploadController.service.ts index 12fb9246c..a056db34a 100644 --- a/libs/red-ui-http/src/lib/api/fileUploadController.service.ts +++ b/libs/red-ui-http/src/lib/api/fileUploadController.service.ts @@ -142,8 +142,9 @@ export class FileUploadControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request('get', `${this.basePath}/download/annotated/${encodeURIComponent(String(fileId))}`, + return this.httpClient.request('get', `${this.basePath}/download/annotated/${encodeURIComponent(String(fileId))}`, { + responseType: 'blob', params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, @@ -201,8 +202,9 @@ export class FileUploadControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request('get', `${this.basePath}/download/original/${encodeURIComponent(String(fileId))}`, + return this.httpClient.request('get', `${this.basePath}/download/original/${encodeURIComponent(String(fileId))}`, { + responseType: 'blob', params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, @@ -260,8 +262,9 @@ export class FileUploadControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request('get', `${this.basePath}/download/redacted/${encodeURIComponent(String(fileId))}`, + return this.httpClient.request('get', `${this.basePath}/download/redacted/${encodeURIComponent(String(fileId))}`, { + responseType: 'blob', params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, @@ -325,8 +328,9 @@ export class FileUploadControllerService { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request('post', `${this.basePath}/download/report`, + return this.httpClient.request('post', `${this.basePath}/download/report`, { + responseType: 'blob', body: body, params: queryParameters, withCredentials: this.configuration.withCredentials, @@ -385,8 +389,9 @@ export class FileUploadControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request('get', `${this.basePath}/download/report/${encodeURIComponent(String(projectId))}`, + return this.httpClient.request('get', `${this.basePath}/download/report/${encodeURIComponent(String(projectId))}`, { + responseType: 'blob', params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers,