diff --git a/src/pages/Customer/components/CustomerAddressEdit.vue b/src/pages/Customer/components/CustomerAddressEdit.vue index 88abcaa77..1f7b4c1e8 100644 --- a/src/pages/Customer/components/CustomerAddressEdit.vue +++ b/src/pages/Customer/components/CustomerAddressEdit.vue @@ -93,10 +93,20 @@ const updateAddressTicket = async () => { }; const updateObservations = async (payload) => { + if (isPayloadEmpty(payload)) return; await axios.post('AddressObservations/crud', payload); notes.value = []; deletes.value = []; }; + +function isPayloadEmpty(payload) { + return ['creates', 'deletes', 'updates'].every( + (prop) => + !payload[prop] || + payload[prop].length === 0 || + payload[prop].every((item) => item === undefined || item === null), + ); +} async function updateAll({ data, payload }) { await updateObservations(payload); await updateAddress(data); @@ -180,7 +190,7 @@ function handleLocation(data, location) {