Update inventoryService.ts
This commit is contained in:
parent
23f8818257
commit
c69625e43d
@ -379,8 +379,14 @@ export const addItem = async (
|
||||
]
|
||||
}
|
||||
};
|
||||
} else {
|
||||
const itemIndex = inventory.LevelKeys.findIndex(i => i.ItemType === typeName);
|
||||
|
||||
if (itemIndex !== -1) {
|
||||
inventory.LevelKeys[itemIndex].ItemCount += quantity;
|
||||
} else {
|
||||
inventory.LevelKeys.push({ ItemType: typeName, ItemCount: quantity });
|
||||
}
|
||||
return {
|
||||
InventoryChanges: {
|
||||
LevelKeys: [
|
||||
|
Loading…
x
Reference in New Issue
Block a user