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", }); }