Эх сурвалжийг харах

Fix edit ingredient button

Lee Morgan 6 жил өмнө
parent
commit
8f6f57905d

+ 3 - 5
views/inventory/inventory.js

@@ -1,5 +1,6 @@
 let items = []; //the ingredients to be displayed
 let items = []; //the ingredients to be displayed
 let tbody = document.querySelector("tbody");
 let tbody = document.querySelector("tbody");
+console.log(merchant);
 
 
 //Remove any existing ingredients in table
 //Remove any existing ingredients in table
 //loop through items and create rows for the table
 //loop through items and create rows for the table
@@ -102,11 +103,8 @@ let updateOne = (id, row, originalQuantity)=>{
     if(validator.ingredient.quantity(quantity)){
     if(validator.ingredient.quantity(quantity)){
         let updateIngredient = merchant.inventory.find(i => i._id === id);
         let updateIngredient = merchant.inventory.find(i => i._id === id);
         updateIngredient.quantity = quantity;
         updateIngredient.quantity = quantity;
-        axios.post("/ingredients/update", {
-            id: id,
-            quantity: quantity
-        })
-            .then((ingredient)=>{
+        axios.post("merchant/update", merchant)
+            .then((merchant)=>{
                 banner.createNotification("The ingredient has been successfully updated");
                 banner.createNotification("The ingredient has been successfully updated");
             })
             })
             .catch((err)=>{
             .catch((err)=>{