mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-22 07:40:32 +00:00
fix: handle delete items error.
This commit is contained in:
@@ -97,6 +97,16 @@ function ItemsList({
|
|||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
setDeleteItem(false);
|
setDeleteItem(false);
|
||||||
|
}).catch(({ errors }) => {
|
||||||
|
if (errors.find(error => error.type === 'ITEM_HAS_ASSOCIATED_TRANSACTINS')) {
|
||||||
|
AppToaster.show({
|
||||||
|
message: formatMessage({
|
||||||
|
id: 'the_item_has_associated_transactions',
|
||||||
|
}),
|
||||||
|
intent: Intent.DANGER,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setDeleteItem(false);
|
||||||
});
|
});
|
||||||
}, [requestDeleteItem, deleteItem, formatMessage]);
|
}, [requestDeleteItem, deleteItem, formatMessage]);
|
||||||
|
|
||||||
|
|||||||
@@ -814,5 +814,6 @@ export default {
|
|||||||
item_code: 'Item code',
|
item_code: 'Item code',
|
||||||
quantity_on_hand: 'Quantity on hand',
|
quantity_on_hand: 'Quantity on hand',
|
||||||
average_rate: 'Average rate',
|
average_rate: 'Average rate',
|
||||||
the_name_used_before: 'The name is already used.'
|
the_name_used_before: 'The name is already used.',
|
||||||
|
the_item_has_associated_transactions: 'The item has associated transactions.'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export const deleteItem = ({ id }) => {
|
|||||||
resolve(response);
|
resolve(response);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
reject(error);
|
reject(error?.response?.data);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user