diff --git a/resources/js/Components/Common/Reporting/ReportingExportButton.vue b/resources/js/Components/Common/Reporting/ReportingExportButton.vue index cc92e030..ce074a85 100644 --- a/resources/js/Components/Common/Reporting/ReportingExportButton.vue +++ b/resources/js/Components/Common/Reporting/ReportingExportButton.vue @@ -3,43 +3,47 @@ import { SecondaryButton } from '@/packages/ui/src'; import { ArrowDownTrayIcon } from '@heroicons/vue/20/solid'; import Dropdown from '@/packages/ui/src/Input/Dropdown.vue'; import type { ExportFormat } from '@/types/reporting'; +import { ref } from 'vue'; -const emit = defineEmits<{ - submit: [ExportFormat]; +const props = defineProps<{ + download: (format: ExportFormat) => Promise; }>(); +const loading = ref(false); +function triggerDownload(format: ExportFormat) { + loading.value = true; + props.download(format).finally(() => { + loading.value = false; + }); +}