mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 08:42:12 +10:00
build fix
This commit is contained in:
@ -8,7 +8,7 @@ import { NextApiRequest, NextApiResponse } from "next";
|
||||
import { useRouter } from "next/router";
|
||||
import fs from "fs";
|
||||
import { buffer } from "stream/consumers";
|
||||
import { Document as PrismaDocument } from "@documenso/prisma/client";
|
||||
import { Document as PrismaDocument } from "@prisma/client";
|
||||
|
||||
async function getHandler(req: NextApiRequest, res: NextApiResponse) {
|
||||
const user = getUserFromToken(req, res);
|
||||
@ -21,7 +21,7 @@ async function getHandler(req: NextApiRequest, res: NextApiResponse) {
|
||||
return;
|
||||
}
|
||||
|
||||
const document: PrismaDocument = await prisma.document.findFirst({
|
||||
const document: PrismaDocument = await prisma.document.findFirstOrThrow({
|
||||
where: {
|
||||
id: +documentId,
|
||||
},
|
||||
@ -30,7 +30,7 @@ async function getHandler(req: NextApiRequest, res: NextApiResponse) {
|
||||
if (!document)
|
||||
res.status(404).end(`No document with id ${documentId} found.`);
|
||||
|
||||
console.log("document: " + document.document);
|
||||
console.log("document: " + document?.document);
|
||||
const buffer: Buffer = Buffer.from(document.document.toString(), "base64");
|
||||
res.setHeader("Content-Type", "application/pdf");
|
||||
res.setHeader("Content-Disposition", "attachment; filename=dummy.pdf");
|
||||
|
||||
Reference in New Issue
Block a user