Skip to content

Commit 56eaa93

Browse files
committed
feat: show downloading toast after response is 200
1 parent 05042d3 commit 56eaa93

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Shared/Hooks/UseDownload/UseDownload.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ const useDownload = () => {
4242
downloadSuccessToastContent = 'Downloaded Successfully',
4343
}: HandleDownloadProps): Promise<Error | ServerErrors> => {
4444
setIsDownloading(true)
45-
if (showFilePreparingToast) {
46-
toast.info(
47-
<ToastBody
48-
title="Preparing file for download"
49-
subtitle="File will be downloaded when it is available."
50-
/>,
51-
)
52-
}
5345
try {
5446
const response = await getDownloadResponse(downloadUrl)
5547
if (response.status === API_STATUS_CODES.OK) {
48+
if (showFilePreparingToast) {
49+
toast.info(
50+
<ToastBody
51+
title="Preparing file for download"
52+
subtitle="File will be downloaded when it is available."
53+
/>,
54+
)
55+
}
5656
const data = await (response as any).blob()
5757

5858
// Create a new URL object

0 commit comments

Comments
 (0)