fix: call upsert when crudModel haschanges
This commit is contained in:
parent
6de4d5f123
commit
7358dab1d0
|
@ -296,6 +296,7 @@ defineExpose({
|
||||||
reload,
|
reload,
|
||||||
redirect: redirectFn,
|
redirect: redirectFn,
|
||||||
selected,
|
selected,
|
||||||
|
CrudModelRef,
|
||||||
});
|
});
|
||||||
|
|
||||||
function handleOnDataSaved(_, res) {
|
function handleOnDataSaved(_, res) {
|
||||||
|
|
|
@ -262,10 +262,13 @@ const updateMinPrice = async (value, props) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const upsertPrice = async ({ row }, resetMinPrice = false) => {
|
const upsertPrice = async (props, resetMinPrice = false) => {
|
||||||
try {
|
try {
|
||||||
if (resetMinPrice) row.hasMinPrice = 0;
|
const { row } = props;
|
||||||
row = await upsertFixedPrice(row);
|
if (tableRef.value.CrudModelRef.getChanges().updates.length > 0) {
|
||||||
|
if (resetMinPrice) row.hasMinPrice = 0;
|
||||||
|
await upsertFixedPrice(row);
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error editing price', err);
|
console.error('Error editing price', err);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue