Skip to content

Commit d218ae4

Browse files
committed
bug fix for updating inventory list
1 parent 8875a80 commit d218ae4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

vue-frontend/warehouse-frontend/src/views/ParentPage.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,13 @@ export default {
121121
this.transactionsList.unshift(transaction);
122122
if (transaction.response_type === "OK") {
123123
playSuccessSound();
124-
const foundAsset = data.parent_data.child_assets.find(asset => asset.Name === transaction.assetId);
125-
this.inventoryList.unshift(foundAsset);
126-
localStorage.setItem('inventoryList', JSON.stringify(this.inventoryList));
124+
const isAssetExist = this.inventoryList.find(asset => asset.Name === transaction.assetId);
125+
if (!isAssetExist) {
126+
const foundAsset = data.parent_data.child_assets.find(asset => asset.Name === transaction.assetId);
127+
this.inventoryList.unshift(foundAsset);
128+
localStorage.setItem('inventoryList', JSON.stringify(this.inventoryList));
129+
}
130+
127131
} else if (transaction.response_type === "Problem") {
128132
playErrorSound();
129133
} else if (transaction.response_type === "Verify") {

0 commit comments

Comments
 (0)