Skip to content

Commit

Permalink
Update MenuAPI.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayanksaininh authored Aug 9, 2024
1 parent 0fec3c1 commit 27892ff
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions Html-files/MenuAPI.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
let iconcartspan = document.querySelector('.cart-subscript');
const menuContainer = document.querySelector(".menu-container");
let categories = [
"Indian",
"lamb",
"goat",
"beef",
Expand All @@ -15,7 +16,6 @@ let categories = [
"breakfast",
"vegetarian",
"miscellaneous",
"Indian",
"Italian",
"Mexican",
"Chinese",
Expand Down Expand Up @@ -355,4 +355,25 @@ async function getMealsByCategory(category) {
const data = await response.json();
return data.meals || [];
}
}
}




async function getMealsByCategory(category) {
if (category.toLowerCase() === 'indian') {
return [
{ strMeal: "kadhai paneer", strMealThumb: "../Images/paneer.jpg", idMeal: "c1" },
{ strMeal: "Makhni daal", strMealThumb: "../Images/daal.jpg", idMeal: "c2" },
{ strMeal: "curry", strMealThumb: "../Images/curry.jpg", idMeal: "c3" },
{ strMeal: "mix veg", strMealThumb: "../Images/mix veg.jpg", idMeal: "c3" },
{ strMeal: "chole bhature", strMealThumb: "../Images/chole.jpg", idMeal: "c4" },
{ strMeal: "soya chaap", strMealThumb: "../Images/chaap.jpg", idMeal: "c5" },
];
} else{
const url = `https://www.themealdb.com/api/json/v1/1/filter.php?c=${category}`;
const response = await fetch(url);
const data = await response.json();
return data.meals || [];
}
}

0 comments on commit 27892ff

Please sign in to comment.