mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-11 03:24:16 +00:00
handle download
erros
This commit is contained in:
parent
fa89325b9d
commit
7a41913207
@ -98,7 +98,6 @@ export default {
|
|||||||
label: "Download media",
|
label: "Download media",
|
||||||
icon: "Download",
|
icon: "Download",
|
||||||
action: () => {
|
action: () => {
|
||||||
app.message.info("Downloading media...")
|
|
||||||
download(media.src)
|
download(media.src)
|
||||||
control.close()
|
control.close()
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
export default (uri, filename) => {
|
export default (uri, filename) => {
|
||||||
|
app.message.info("Downloading media...")
|
||||||
|
|
||||||
fetch(uri, {
|
fetch(uri, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/pdf",
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
.then((response) => response.blob())
|
.then((response) => response.blob())
|
||||||
.then((blob) => {
|
.then((blob) => {
|
||||||
@ -29,4 +28,8 @@ export default (uri, filename) => {
|
|||||||
// Clean up and remove the link
|
// Clean up and remove the link
|
||||||
link.parentNode.removeChild(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