Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 14d56ab

Browse files
committed
changes for #359
1 parent 830c106 commit 14d56ab

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

client/src/components/Upload/Initial/index.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@ export default function Initial({ onError, onUpload, templateId }) {
2626

2727
const [invalidFileExtension, setInvalidFileExtension] = React.useState(false);
2828

29+
const [isDisabledDownload, disableDownload] = React.useState(false);
2930
const downloadTemplate = async () => {
31+
disableDownload(true);
3032
const url = `${config.API_PREFIX}/templates/${templateId}`;
3133
try {
3234
const { data } = await apiClient.get(url);
3335
window.location = data.url;
3436
} catch (error) {
3537
if (onError) onError(error);
3638
}
39+
disableDownload(false);
3740
};
3841

3942
const upload = (files) => {
@@ -96,7 +99,7 @@ export default function Initial({ onError, onUpload, templateId }) {
9699
</span>
97100
</div>
98101
<div className={style.label2}>Supports XLS, XLSX or CSV file</div>
99-
<div className={style.label3} onClick={downloadTemplate}>
102+
<div className={style.label3} onClick={downloadTemplate} disabled={isDisabledDownload}>
100103
Download Import Template (.XLSX)
101104
</div>
102105
</>

client/src/components/Upload/Initial/style.module.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@
5353
text-underline-position: under;
5454
}
5555

56+
.label3[disabled]
57+
{
58+
pointer-events: none;
59+
opacity: 0.7;
60+
}
61+
5662
.message {
5763
position: absolute;
5864
top: 0;

0 commit comments

Comments
 (0)