forked from verdnatura/salix-front
fix: call upsert when crudModel haschanges
This commit is contained in:
parent
6de4d5f123
commit
7358dab1d0
|
@ -296,6 +296,7 @@ defineExpose({
|
|||
reload,
|
||||
redirect: redirectFn,
|
||||
selected,
|
||||
CrudModelRef,
|
||||
});
|
||||
|
||||
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 {
|
||||
if (resetMinPrice) row.hasMinPrice = 0;
|
||||
row = await upsertFixedPrice(row);
|
||||
const { row } = props;
|
||||
if (tableRef.value.CrudModelRef.getChanges().updates.length > 0) {
|
||||
if (resetMinPrice) row.hasMinPrice = 0;
|
||||
await upsertFixedPrice(row);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error editing price', err);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue