Update page.tsx

This commit is contained in:
NotII
2025-03-25 15:39:45 +00:00
parent f209fb6a3a
commit 849663d81b

View File

@@ -139,10 +139,16 @@ export default function ProductsPage() {
const formData = new FormData(); const formData = new FormData();
formData.append("file", file); formData.append("file", file);
await clientFetch(imageEndpoint, { await fetch(`${process.env.NEXT_PUBLIC_API_URL}${imageEndpoint}`, {
method: "PUT", method: "PUT",
headers: {
Authorization: `Bearer ${document.cookie
.split("; ")
.find((row) => row.startsWith("Authorization="))
?.split("=")[1]}`,
},
body: formData, body: formData,
headers: {}, // Let the browser set the content-type for FormData credentials: "include",
}); });
} }