From 250d73cdb5cf89f64840704dd461e874d0032263 Mon Sep 17 00:00:00 2001 From: "tilak.gondi" <115203844+GondiTilak@users.noreply.github.com> Date: Fri, 23 Jun 2023 13:57:59 +0900 Subject: [PATCH] [MALI-1050] [JS Sample App] Infinite Loading is observed on downloading modified Base64 data (#257) * [MALI-1050] [JS Sample App] Infinite Loading is observed on downloading modified Base64 data Updated the callback function for the download file action in the sample app to throw the error to present in sample app UI. **Link:** [MALI-1050](https://jira.rakuten-it.com/jira/browse/MALI-1050) * [MALI-1050] [JS Sample App] Infinite Loading is observed on downloading modified Base64 data Resolve prettify lint errors in the last changed files. **Link:** [MALI-1050](https://jira.rakuten-it.com/jira/browse/MALI-1050) * Update js-miniapp-sample/src/pages/file-download.js Committing the suggested changes. Co-authored-by: leojoseph.r <58416454+rleojoseph@users.noreply.github.com> --------- Co-authored-by: leojoseph.r <58416454+rleojoseph@users.noreply.github.com> --- js-miniapp-sample/src/pages/file-download.js | 15 +++++++++++++-- .../src/services/filedownload/actions.js | 4 +++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/js-miniapp-sample/src/pages/file-download.js b/js-miniapp-sample/src/pages/file-download.js index 9dc6ddc50..6c30c0678 100644 --- a/js-miniapp-sample/src/pages/file-download.js +++ b/js-miniapp-sample/src/pages/file-download.js @@ -127,7 +127,17 @@ const FileDownload = (props: FileDownloadProps) => { function startFileDownload(url, fileName) { setIsPermissionGranted(true); - return props.downloadFile(fileName, url, { token: 'test' }); + return props + .downloadFile(fileName, url, { token: 'test' }) + .then((downloadedFile) => { + console.log('FileDownloadRsponse THEN:', downloadedFile); + props.downloadedFile = downloadedFile; + }) + .catch((error) => { + console.log('FileDownloadErrors CATCH:', error); + props.error = error; + props.isLoading = false; + }); } function handleDownloadClick(url, fileName) { @@ -174,7 +184,8 @@ const FileDownload = (props: FileDownloadProps) => {
{!isPermissionGranted && '"FILE_DOWNLOAD" permission not granted.'} - {props.error && props.error.message} + {props.error && 'Download failed: ' + props.error.message} + {props.downloadedFile && 'File Downloaded:' + props.downloadedFile}