diff --git a/frontend/app/components/InternshipDocumentViewer.vue b/frontend/app/components/InternshipDocumentViewer.vue index 38a9819..d4dbb63 100644 --- a/frontend/app/components/InternshipDocumentViewer.vue +++ b/frontend/app/components/InternshipDocumentViewer.vue @@ -7,16 +7,6 @@ const props = defineProps<{ const client = useSanctumClient(); -function triggerDownload(file: Blob, file_name: string) { - const url = window.URL.createObjectURL(file); - const link = document.createElement('a'); - link.href = url; - link.download = `${file_name}.pdf`; - link.target = "_blank"; - link.click(); - window.URL.revokeObjectURL(url); -} - async function downloadAgreement() { const agreement: Blob = await client(`/api/internships/${props.internship.id}/agreement`); triggerDownload(agreement, `agreement-${props.internship.id}`); diff --git a/frontend/app/utils/index.ts b/frontend/app/utils/index.ts new file mode 100644 index 0000000..55c4517 --- /dev/null +++ b/frontend/app/utils/index.ts @@ -0,0 +1,9 @@ +export function triggerDownload(file: Blob, file_name: string) { + const url = window.URL.createObjectURL(file); + const link = document.createElement('a'); + link.href = url; + link.download = `${file_name}.pdf`; + link.target = "_blank"; + link.click(); + window.URL.revokeObjectURL(url); +} \ No newline at end of file