Преглед изворни кода

Remove ability to delete recipes.

Lee Morgan пре 6 година
родитељ
комит
77b90db2e2
4 измењених фајлова са 0 додато и 18 уклоњено
  1. 0 11
      controllers/home.js
  2. 0 1
      routes.js
  3. 0 2
      views/recipesPage/recipes.ejs
  4. 0 4
      views/recipesPage/recipes.js

+ 0 - 11
controllers/home.js

@@ -284,16 +284,5 @@ module.exports = {
                 console.log(err);
                 res.render("error");
             })
-    },
-
-    deleteRecipe: function(req, res){
-        Recipe.findOneAndDelete(req.body.id)
-            .then((recipe)=>{
-                return res.json(recipe);
-            })
-            .catch((err)=>{
-                console.log(err);
-                return res.render("error");
-            });
     }
 }

+ 0 - 1
routes.js

@@ -12,5 +12,4 @@ module.exports = function(app){
     app.get("/recipes", home.displayRecipes);
     app.post("/recipes/ingredients/remove", home.deleteRecipeIngredient);
     app.post("/recipes/ingredients/update", home.updateRecipeIngredient);
-    app.post("/recipes/remove", home.deleteRecipe);
 }

+ 0 - 2
views/recipesPage/recipes.ejs

@@ -13,8 +13,6 @@
 
         <div id="recipes" class="container"></div>
 
-        <button id="delRecipe">Delete Recipe</button>
-
         <div id="ingredient" class="container">
             <table>
                 <thead>

+ 0 - 4
views/recipesPage/recipes.js

@@ -39,10 +39,6 @@ let recipesPage = {
         recipesDiv.style.display = "none";
         ingredientDiv.style.display = "flex";
 
-        let delRecipe = document.querySelector("#delRecipe");
-        delRecipe.style.display = "inline-block";
-        delRecipe.onclick = ()=>{this.deleteRecipe(recipe);};
-
         for(let ingredient of recipe.ingredients){
             let row = document.createElement("tr");
             row.recipeId = recipe._id;