mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
handle download
erros
This commit is contained in:
parent
fa89325b9d
commit
7a41913207
@ -98,7 +98,6 @@ export default {
|
||||
label: "Download media",
|
||||
icon: "Download",
|
||||
action: () => {
|
||||
app.message.info("Downloading media...")
|
||||
download(media.src)
|
||||
control.close()
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
export default (uri, filename) => {
|
||||
app.message.info("Downloading media...")
|
||||
|
||||
fetch(uri, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/pdf",
|
||||
},
|
||||
})
|
||||
.then((response) => response.blob())
|
||||
.then((blob) => {
|
||||
@ -29,4 +28,8 @@ export default (uri, filename) => {
|
||||
// Clean up and remove the link
|
||||
link.parentNode.removeChild(link)
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
app.message.error("Failed to download media")
|
||||
})
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user