diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue index 783600547..96b550205 100644 --- a/src/components/CrudModel.vue +++ b/src/components/CrudModel.vue @@ -77,10 +77,6 @@ const $props = defineProps({ type: Boolean, default: true, }, - hasDifferentVerb: { - type: Boolean, - default: false, - }, }); const isLoading = ref(false); @@ -91,7 +87,7 @@ const formData = ref(); const saveButtonRef = ref(null); const watchChanges = ref(); const formUrl = computed(() => $props.url); -const saveData = ref(); + const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']); defineExpose({ @@ -185,7 +181,6 @@ async function saveChanges(data) { return; } let changes = data || getChanges(); - let url = $props.saveUrl || $props.url + '/crud'; if ($props.beforeSaveFn) changes = await $props.beforeSaveFn(changes, getChanges); try { @@ -193,8 +188,7 @@ async function saveChanges(data) { return; } - if ($props.hasDifferentVerb) await axios.patch(url, saveData.value); - else await axios.post(url, changes); + await axios.post($props.saveUrl || $props.url + '/crud', changes); } finally { isLoading.value = false; } @@ -271,7 +265,6 @@ function getChanges() { } else if (originalData.value[i]) { const data = getDifferences(originalData.value[i], row); if (!isEmpty(data)) { - saveData.value = row; updates.push({ data, where: { [pk]: row[pk] }, diff --git a/src/pages/Item/ItemFixedPrice.vue b/src/pages/Item/ItemFixedPrice.vue index aa141cb72..807724865 100644 --- a/src/pages/Item/ItemFixedPrice.vue +++ b/src/pages/Item/ItemFixedPrice.vue @@ -273,8 +273,7 @@ watch( data-key="ItemFixedPrices" url="FixedPrices/filter" :order="'name DESC'" - save-url="FixedPrices/upsertFixedPrice" - :hasDifferentVerb="true" + save-url="FixedPrices/formatFixedPriceData" :columns="columns" :is-editable="true" :right-search="false"