commit
This commit is contained in:
@@ -12,9 +12,15 @@ type Params = {
|
||||
params: Promise<{ id: string }>;
|
||||
};
|
||||
|
||||
export async function GET(_request: NextRequest, { params }: Params) {
|
||||
export async function GET(request: NextRequest, { params }: Params) {
|
||||
try {
|
||||
const { id } = await params;
|
||||
const templateVariant = request.nextUrl.searchParams.get('templateVariant');
|
||||
|
||||
if (templateVariant && templateVariant !== 'product-v1') {
|
||||
return NextResponse.json({ message: 'Unsupported template variant' }, { status: 400 });
|
||||
}
|
||||
|
||||
const { organization, session, membership } = await requireOrganizationAccess({
|
||||
permission: PERMISSIONS.crmQuotationPdfPreview
|
||||
});
|
||||
@@ -36,7 +42,9 @@ export async function GET(_request: NextRequest, { params }: Params) {
|
||||
return NextResponse.json({ message: 'Forbidden' }, { status: 403 });
|
||||
}
|
||||
|
||||
const pdf = await generateQuotationPreviewPdf(id, organization.id);
|
||||
const pdf = await generateQuotationPreviewPdf(id, organization.id, {
|
||||
templateVariant
|
||||
});
|
||||
|
||||
return new NextResponse(pdf.buffer, {
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user