Procházet zdrojové kódy

Can no longer remove ingredient if it is in a recipe

Lee Morgan před 6 roky
rodič
revize
0883355e5e
2 změnil soubory, kde provedl 1 přidání a 4 odebrání
  1. 1 1
      controllers/merchantData.js
  2. 0 3
      views/inventoryPage/inventory.js

+ 1 - 1
controllers/merchantData.js

@@ -370,7 +370,7 @@ module.exports = {
         Merchant.findOne({_id: req.session.user})
             .then((merchant)=>{
                 for(let i = 0; i < merchant.inventory.length; i++){
-                    if(req.body.ingredientId === merchant.inventory[i]._id.toString()){
+                    if(req.body.ingredientId === merchant.inventory[i].ingredient._id.toString()){
                         merchant.inventory.splice(i, 1);
                         break;
                     }

+ 0 - 3
views/inventoryPage/inventory.js

@@ -1,6 +1,3 @@
-item.id
-items
-
 let inventoryObj = {
     items: [],
     currentSort: "",