()
| 41 | } |
| 42 | |
| 43 | function handleSave() { |
| 44 | if (!copy.name || isEqual(copy, item)) return; |
| 45 | const newCategory = !app.categories.map(c => c.id).includes(copy.categoryId); |
| 46 | updateItem({ ...copy, newCategory }) |
| 47 | .then(newItem => { |
| 48 | setCopy(newItem); |
| 49 | alertSuccess({ message: 'Item Updated.', duration: 2 }); |
| 50 | if (newCategory) { |
| 51 | app.fetchUser(); |
| 52 | } |
| 53 | }) |
| 54 | .catch(() => alertWarn({ message: 'Error updating item.' })); |
| 55 | } |
| 56 | |
| 57 | const categoryValue = categorySelectValue(app.categories, copy.categoryId); |
| 58 | const { product_name, name, weight_unit, weight } = copy; |
no test coverage detected