Phase2: Invoicecomputation/AdminpricingUI/Ainvoicemgnt
Some checks failed
Build and Push / build (push) Failing after 45s

This commit is contained in:
2026-05-24 14:12:26 +02:00
parent cdc2210eaf
commit d4fcc33bc1
4 changed files with 26 additions and 27 deletions

View File

@@ -26,9 +26,16 @@ export async function GET(
if (!pdf) {
return new NextResponse("Not found", { status: 404 });
}
// Construct a response that the browser will render inline (PDF
// viewer) but also offer to download with the right filename.
return new NextResponse(pdf.data, {
// Web `Response`'s `BodyInit` doesn't include Node's `Buffer` — pg
// returns bytea as Buffer but Next/the runtime want a BufferSource.
// Wrap into a zero-copy Uint8Array view (Buffer extends Uint8Array
// under the hood, but TypeScript treats them as distinct).
const body = new Uint8Array(
pdf.data.buffer,
pdf.data.byteOffset,
pdf.data.byteLength
);
return new NextResponse(body, {
status: 200,
headers: {
"Content-Type": "application/pdf",