Fix: Pass photo request ID instead of data URL
Changed approach to pass customRequestId query parameter instead of the full data URL. The design canvas page now fetches the photo from the database using the request ID, avoiding URL length issues and making the URL cleaner.
This commit is contained in:
@@ -81,7 +81,8 @@
|
||||
"Bash(git commit -m 'Fix: Refresh page after updating order tracking details *)",
|
||||
"Bash(git commit -m 'Fix: Remove function prop from client component *)",
|
||||
"Bash(git commit -m 'Fix: Import revalidatePath from correct module *)",
|
||||
"Bash(git commit -m 'Fix: Route photo requests to design canvas instead of approval upload *)"
|
||||
"Bash(git commit -m 'Fix: Route photo requests to design canvas instead of approval upload *)",
|
||||
"Bash(git commit -m 'Fix: Pass photo request ID instead of data URL *)"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export default async function CustomRequestDetailPage({ params }: { params: { id
|
||||
const whatsappMessage = `Hi ${request.customerName}, thanks for sending over your photo for a ${request.product.name} — we're working on it!`;
|
||||
|
||||
const designParams = new URLSearchParams({
|
||||
customPhoto: request.imageDataUrl,
|
||||
customRequestId: request.id,
|
||||
});
|
||||
|
||||
return (
|
||||
|
||||
@@ -12,7 +12,7 @@ export default async function ProductDetailPage({
|
||||
searchParams,
|
||||
}: {
|
||||
params: { slug: string };
|
||||
searchParams: { customPhoto?: string };
|
||||
searchParams: { customRequestId?: string };
|
||||
}) {
|
||||
const activePromotions = await fetchActivePromotions();
|
||||
|
||||
@@ -27,9 +27,20 @@ export default async function ProductDetailPage({
|
||||
});
|
||||
const related = relatedRows.map((p) => toProductDTO(p, activePromotions));
|
||||
|
||||
// Fetch custom photo from request if customRequestId is provided
|
||||
let customPhoto: string | undefined;
|
||||
if (searchParams.customRequestId) {
|
||||
const customRequest = await prisma.customRequest.findUnique({
|
||||
where: { id: searchParams.customRequestId },
|
||||
});
|
||||
if (customRequest) {
|
||||
customPhoto = customRequest.imageDataUrl;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="mx-auto max-w-6xl px-6 py-12">
|
||||
<DesignCanvas product={product} customPhoto={searchParams.customPhoto} />
|
||||
<DesignCanvas product={product} customPhoto={customPhoto} />
|
||||
|
||||
{related.length > 0 && (
|
||||
<section className="mt-20 border-t border-line pt-12">
|
||||
|
||||
Reference in New Issue
Block a user