title: auto
des: auto note:auto
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
import { NextResponse } from "next/server";
|
import { NextRequest, NextResponse } from "next/server";
|
||||||
import fs from "fs"
|
import fs from "fs";
|
||||||
|
|
||||||
export async function GET({ params }: { params: { id: string } }) {
|
export async function GET(
|
||||||
|
req: NextRequest,
|
||||||
|
{ params }: { params: { id: string } }
|
||||||
|
) {
|
||||||
const data = await prisma.prospektusInvestasi.findUnique({
|
const data = await prisma.prospektusInvestasi.findUnique({
|
||||||
where: { id: params.id },
|
where: { id: params.id },
|
||||||
select: {
|
select: {
|
||||||
@@ -10,10 +13,10 @@ export async function GET({ params }: { params: { id: string } }) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const file = fs.readFileSync(`./public/file/${data?.url}`)
|
const file = fs.readFileSync(`./public/file/${data?.url}`);
|
||||||
return new NextResponse(file, {
|
return new NextResponse(file, {
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type":"application/pdf"
|
"Content-Type": "application/pdf",
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user