From 849663d81be189cc7cc803b8163cc44506156f3d Mon Sep 17 00:00:00 2001 From: NotII <46204250+NotII@users.noreply.github.com> Date: Tue, 25 Mar 2025 15:39:45 +0000 Subject: [PATCH] Update page.tsx --- app/dashboard/products/page.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/dashboard/products/page.tsx b/app/dashboard/products/page.tsx index 4c12407..b182348 100644 --- a/app/dashboard/products/page.tsx +++ b/app/dashboard/products/page.tsx @@ -139,10 +139,16 @@ export default function ProductsPage() { const formData = new FormData(); formData.append("file", file); - await clientFetch(imageEndpoint, { + await fetch(`${process.env.NEXT_PUBLIC_API_URL}${imageEndpoint}`, { method: "PUT", + headers: { + Authorization: `Bearer ${document.cookie + .split("; ") + .find((row) => row.startsWith("Authorization=")) + ?.split("=")[1]}`, + }, body: formData, - headers: {}, // Let the browser set the content-type for FormData + credentials: "include", }); }