wip: create course generate

This commit is contained in:
2024-06-24 22:03:46 +08:00
parent 4ef71c2691
commit 48aced8b6e
4 changed files with 126 additions and 27 deletions

View File

@@ -0,0 +1,16 @@
export const useDownload = (url: string, filename: string) => {
const download = () => {
fetch(url)
.then((response) => response.blob())
.then((blob) => {
const url = window.URL.createObjectURL(new Blob([blob]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', filename)
document.body.appendChild(link)
link.click()
link.parentNode?.removeChild(link)
})
}
return { download }
}