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:
Andymick
2026-07-18 21:05:36 +01:00
parent 8e7d242c58
commit 0d9aef5003
3 changed files with 16 additions and 4 deletions
+13 -2
View File
@@ -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">