This commit is contained in:
Viet An
2026-06-04 13:57:27 +07:00
parent 2981d9790a
commit 2a1f85c2af
44 changed files with 99 additions and 102 deletions

View File

@@ -47,15 +47,17 @@ async function submit() {
// 1. insert row to Product_Image, get back id
if (uploadedImage.value) {
const productImage = await $insertapi("Product_Image", {
name: uploadedImage.value.name,
path: $buildFileUrl(uploadedImage.value.file),
data: {
name: uploadedImage.value.name,
path: $buildFileUrl(uploadedImage.value.file),
},
});
body.value.image = productImage.id;
}
// 2. upload to Product_Variant table
const trimmedBody = omitBy(body.value, $empty);
const res = await $insertapi("Product_Variant", trimmedBody);
const res = await $insertapi("Product_Variant", { data: trimmedBody });
if (res !== "error") {
if (refreshData) refreshData();
}