fix: ensure invoice downloads as PDF regardless of URL type

This commit is contained in:
seaznCode 2026-04-22 20:27:56 +02:00
parent 152f01f0b0
commit 44a86f0b0f

View File

@ -113,8 +113,7 @@ export default function FinanceInvoices({ abonementId }: Props) {
if (!res.ok) throw new Error(`Download failed: ${res.status}`)
const blob = await res.blob()
const invoiceNo = invoice.invoiceNumber || String(invoice.id)
const ext = invoice.pdfUrl ? 'pdf' : 'html'
downloadBlob(blob, `invoice-${invoiceNo}.${ext}`)
downloadBlob(blob, `invoice-${invoiceNo}.pdf`)
} else {
const blob = new Blob([JSON.stringify(invoice.raw, null, 2)], { type: 'application/json' })
downloadBlob(blob, `invoice-${invoice.invoiceNumber || invoice.id}.json`)