Refine machine details layout and improve download feedback
This commit is contained in:
parent
5f7efa13e6
commit
1251468b77
6 changed files with 96 additions and 10 deletions
|
|
@ -613,6 +613,8 @@ function CommentAttachmentCard({
|
|||
const handleDownload = useCallback(async () => {
|
||||
const target = url ?? (await ensureUrl())
|
||||
if (!target) return
|
||||
const toastId = `attachment-download-${attachment.id}`
|
||||
toast.loading("Baixando anexo...", { id: toastId })
|
||||
try {
|
||||
const response = await fetch(target, { credentials: "include" })
|
||||
if (!response.ok) {
|
||||
|
|
@ -630,9 +632,11 @@ function CommentAttachmentCard({
|
|||
window.setTimeout(() => {
|
||||
window.URL.revokeObjectURL(blobUrl)
|
||||
}, 1000)
|
||||
toast.success("Download concluído!", { id: toastId })
|
||||
} catch (error) {
|
||||
console.error("Failed to download attachment", error)
|
||||
window.open(target, "_blank", "noopener,noreferrer")
|
||||
toast.error("Não foi possível baixar o anexo automaticamente.", { id: toastId })
|
||||
}
|
||||
}, [attachment.name, ensureUrl, url])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue