Jelajahi Sumber

Fix bug where removed inventory ingredient is shown again on other action.

Lee Morgan 6 tahun lalu
induk
melakukan
27cfa37bf8
1 mengubah file dengan 4 tambahan dan 3 penghapusan
  1. 4 3
      views/inventory/inventory.js

+ 4 - 3
views/inventory/inventory.js

@@ -132,9 +132,10 @@ let inventoryPage = {
     removeIngredient: function(id, row){
         axios.post("/merchant/ingredients/remove", {ingredientId: id})
             .then(()=>{
-                for(let i = 0; i < this.items.length; i++){
-                    if(id === this.items[i].id){
-                        this.items.splice(i, 1);
+                for(let i = 0; i < merchant.inventory.length; i++){
+                    if(id === merchant.inventory[i]._id){
+                        merchant.inventory.splice(i, 1);
+                        break;
                     }
                 }