changes
This commit is contained in:
@@ -13,7 +13,7 @@ const body = ref({
|
||||
|
||||
async function submit() {
|
||||
isLoading.value = true;
|
||||
const res = await $insertapi("IMEI", body.value);
|
||||
const res = await $insertapi("IMEI", { data: body.value });
|
||||
isLoading.value = false;
|
||||
if (res !== "error") {
|
||||
emit("created");
|
||||
|
||||
@@ -81,7 +81,7 @@ async function submit() {
|
||||
id: productVariant.value.product,
|
||||
...body.value,
|
||||
})
|
||||
: await $insertapi("product", body.value);
|
||||
: await $insertapi("product", { data: body.value });
|
||||
if (res !== "error") {
|
||||
if (refreshData) refreshData();
|
||||
}
|
||||
|
||||
@@ -86,8 +86,10 @@ 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;
|
||||
}
|
||||
@@ -99,7 +101,7 @@ async function submit() {
|
||||
id: props.variantId,
|
||||
...trimmedBody,
|
||||
})
|
||||
: await $insertapi("Product_Variant", trimmedBody);
|
||||
: await $insertapi("Product_Variant", { data: trimmedBody });
|
||||
if (res !== "error") {
|
||||
if (refreshData) refreshData();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ const body = ref({
|
||||
|
||||
async function submit() {
|
||||
isLoading.value = true;
|
||||
const newRow = await $insertapi("Battery", body.value);
|
||||
const newRow = await $insertapi("Battery", { data: body.value });
|
||||
emit("modalevent", { name: "dataevent", data: newRow });
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ const body = ref({
|
||||
|
||||
async function submit() {
|
||||
isLoading.value = true;
|
||||
const newRow = await $insertapi("CPU", body.value);
|
||||
const newRow = await $insertapi("CPU", { data: body.value });
|
||||
emit("modalevent", { name: "dataevent", data: newRow });
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ const body = ref({
|
||||
|
||||
async function submit() {
|
||||
isLoading.value = true;
|
||||
const newRow = await $insertapi("Camera_System", body.value);
|
||||
const newRow = await $insertapi("Camera_System", { data: body.value });
|
||||
emit("modalevent", { name: "dataevent", data: newRow });
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ const body = ref({
|
||||
|
||||
async function submit() {
|
||||
isLoading.value = true;
|
||||
const newRow = await $insertapi("Charging_Technology", body.value);
|
||||
const newRow = await $insertapi("Charging_Technology", { data: body.value });
|
||||
emit("modalevent", { name: "dataevent", data: newRow });
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ const body = ref({
|
||||
|
||||
async function submit() {
|
||||
isLoading.value = true;
|
||||
const newRow = await $insertapi("Color", body.value);
|
||||
const newRow = await $insertapi("Color", { data: body.value });
|
||||
emit("modalevent", { name: "dataevent", data: newRow });
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ const body = ref({
|
||||
|
||||
async function submit() {
|
||||
isLoading.value = true;
|
||||
const newRow = await $insertapi("Design", body.value);
|
||||
const newRow = await $insertapi("Design", { data: body.value });
|
||||
emit("modalevent", { name: "dataevent", data: newRow });
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ const body = ref({
|
||||
|
||||
async function submit() {
|
||||
isLoading.value = true;
|
||||
const newRow = await $insertapi("External_Storage", body.value);
|
||||
const newRow = await $insertapi("External_Storage", { data: body.value });
|
||||
emit("modalevent", { name: "dataevent", data: newRow });
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ const body = ref({
|
||||
|
||||
async function submit() {
|
||||
isLoading.value = true;
|
||||
const newRow = await $insertapi("GPU", body.value);
|
||||
const newRow = await $insertapi("GPU", { data: body.value });
|
||||
emit("modalevent", { name: "dataevent", data: newRow });
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ const body = ref({
|
||||
|
||||
async function submit() {
|
||||
isLoading.value = true;
|
||||
const newRow = await $insertapi("IP_Rating", body.value);
|
||||
const newRow = await $insertapi("IP_Rating", { data: body.value });
|
||||
emit("modalevent", { name: "dataevent", data: newRow });
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ const body = ref({
|
||||
|
||||
async function submit() {
|
||||
isLoading.value = true;
|
||||
const newRow = await $insertapi("Internal_Storage", body.value);
|
||||
const newRow = await $insertapi("Internal_Storage", { data: body.value });
|
||||
emit("modalevent", { name: "dataevent", data: newRow });
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ const body = ref({
|
||||
|
||||
async function submit() {
|
||||
isLoading.value = true;
|
||||
const newRow = await $insertapi("Manufacturer", body.value);
|
||||
const newRow = await $insertapi("Manufacturer", { data: body.value });
|
||||
emit("modalevent", { name: "dataevent", data: newRow });
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ const body = ref({
|
||||
|
||||
async function submit() {
|
||||
isLoading.value = true;
|
||||
const newRow = await $insertapi("Network_Technology", body.value);
|
||||
const newRow = await $insertapi("Network_Technology", { data: body.value });
|
||||
emit("modalevent", { name: "dataevent", data: newRow });
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ const body = ref({
|
||||
|
||||
async function submit() {
|
||||
isLoading.value = true;
|
||||
const newRow = await $insertapi("OS", body.value);
|
||||
const newRow = await $insertapi("OS", { data: body.value });
|
||||
emit("modalevent", { name: "dataevent", data: newRow });
|
||||
|
||||
isLoading.value = false;
|
||||
|
||||
@@ -12,7 +12,7 @@ const body = ref({
|
||||
|
||||
async function submit() {
|
||||
isLoading.value = true;
|
||||
const newRow = await $insertapi("RAM", body.value);
|
||||
const newRow = await $insertapi("RAM", { data: body.value });
|
||||
emit("modalevent", { name: "dataevent", data: newRow });
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ const body = ref({
|
||||
|
||||
async function submit() {
|
||||
isLoading.value = true;
|
||||
const newRow = await $insertapi("SIM", body.value);
|
||||
const newRow = await $insertapi("SIM", { data: body.value });
|
||||
emit("modalevent", { name: "dataevent", data: newRow });
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ const body = ref({
|
||||
|
||||
async function submit() {
|
||||
isLoading.value = true;
|
||||
const newRow = await $insertapi("Screen", body.value);
|
||||
const newRow = await $insertapi("Screen", { data: body.value });
|
||||
emit("modalevent", { name: "dataevent", data: newRow });
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user