mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 12:08:01 +00:00
chore: Adds loader for attachment download buttons (#10748)
This commit is contained in:
@@ -18,6 +18,7 @@ const attachment = computed(() => {
|
||||
|
||||
const hasError = ref(false);
|
||||
const showGallery = ref(false);
|
||||
const isDownloading = ref(false);
|
||||
|
||||
const handleError = () => {
|
||||
hasError.value = true;
|
||||
@@ -26,7 +27,14 @@ const handleError = () => {
|
||||
|
||||
const downloadAttachment = async () => {
|
||||
const { fileType, dataUrl, extension } = attachment.value;
|
||||
downloadFile({ url: dataUrl, type: fileType, extension });
|
||||
try {
|
||||
isDownloading.value = true;
|
||||
await downloadFile({ url: dataUrl, type: fileType, extension });
|
||||
} catch (error) {
|
||||
// error
|
||||
} finally {
|
||||
isDownloading.value = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -60,7 +68,9 @@ const downloadAttachment = async () => {
|
||||
slate
|
||||
icon="i-lucide-download"
|
||||
class="opacity-60"
|
||||
@click="downloadAttachment"
|
||||
:is-loading="isDownloading"
|
||||
:disabled="isDownloading"
|
||||
@click.stop="downloadAttachment"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user