fix: logic error
This commit is contained in:
parent
4937cf7f59
commit
cadb6bc97b
@ -416,7 +416,7 @@ export const addItem = async (
|
|||||||
const key = { ItemType: typeName, ItemCount: quantity };
|
const key = { ItemType: typeName, ItemCount: quantity };
|
||||||
|
|
||||||
const index = inventory.LevelKeys.findIndex(levelKey => levelKey.ItemType == typeName);
|
const index = inventory.LevelKeys.findIndex(levelKey => levelKey.ItemType == typeName);
|
||||||
if (index) {
|
if (index != -1) {
|
||||||
inventory.LevelKeys[index].ItemCount += quantity;
|
inventory.LevelKeys[index].ItemCount += quantity;
|
||||||
} else {
|
} else {
|
||||||
inventory.LevelKeys.push(key);
|
inventory.LevelKeys.push(key);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user