MCPcopy Create free account
hub / github.com/Packstack-Tech/packstack / handleSave

Function handleSave

frontend/src/app/Inventory/Item.tsx:43–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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;

Callers 1

ItemFunction · 0.85

Calls 4

alertSuccessFunction · 0.90
alertWarnFunction · 0.90
isEqualFunction · 0.85
updateItemFunction · 0.85

Tested by

no test coverage detected