Update page.tsx
This commit is contained in:
@@ -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",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user