fix csv export

This commit is contained in:
Emily
2024-09-30 17:08:23 +02:00
parent 3ba6cd171b
commit a08624b69b
2 changed files with 17 additions and 28 deletions

View File

@@ -43,11 +43,11 @@ const creatingCsv = ref<boolean>(false);
async function downloadCSV() {
creatingCsv.value = true;
const result = await $fetch(`/api/project/generate_csv?mode=events&slice=${options.indexOf(selectedTimeFrom.value)}`, signHeaders());
const blob = new Blob([result], { type: 'text/csv' });
const blob = new Blob([result as any], { type: 'text/csv' });
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'ReportVisits.csv';
a.download = 'ReportEvents.csv';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);