From e1f99bd4c49f9cca8b3b010fac3ca776432ada51 Mon Sep 17 00:00:00 2001 From: Anang Yusman Date: Tue, 27 Jan 2026 16:18:24 +0800 Subject: [PATCH] fix :upload image product --- .../form/product/create-product-form.tsx | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/components/form/product/create-product-form.tsx b/components/form/product/create-product-form.tsx index 1cf0ee9..d44de33 100644 --- a/components/form/product/create-product-form.tsx +++ b/components/form/product/create-product-form.tsx @@ -74,9 +74,9 @@ export default function AddProductForm() { formData.append("colors", JSON.stringify(colorsPayload)); // 🔥 color images - colors.forEach((c, index) => { + colors.forEach((c) => { if (c.file) { - formData.append(`color_images[${index}]`, c.file); + formData.append("color_images", c.file); } }); @@ -217,7 +217,14 @@ export default function AddProductForm() { - + { + const updated = [...colors]; + updated[index].name = e.target.value; + setColors(updated); + }} + /> {/* Pilihan Warna */}
@@ -239,7 +246,12 @@ export default function AddProductForm() {