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}