Prechádzať zdrojové kódy

Remove ability to delete recipes.

Lee Morgan 6 rokov pred
rodič
commit
77b90db2e2

+ 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;