Fix adding non-existent item
This commit is contained in:
parent
f30474cb5d
commit
f4e784b2ec
@ -72,7 +72,7 @@ export default function GroceryList() {
|
|||||||
let newQuantity = quantity;
|
let newQuantity = quantity;
|
||||||
|
|
||||||
const item = await getItemByName(itemName);
|
const item = await getItemByName(itemName);
|
||||||
if (item) {
|
if (item.data) {
|
||||||
let currentQuantity = item.data.quantity;
|
let currentQuantity = item.data.quantity;
|
||||||
const yes = window.confirm(
|
const yes = window.confirm(
|
||||||
`Item "${itemName}" already exists in the list. Do you want to update its quantity from ${currentQuantity} to ${currentQuantity + newQuantity}?`
|
`Item "${itemName}" already exists in the list. Do you want to update its quantity from ${currentQuantity} to ${currentQuantity + newQuantity}?`
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user