diff --git a/assets/recipes.html b/assets/recipes.html
index a616934..a4b71de 100644
--- a/assets/recipes.html
+++ b/assets/recipes.html
@@ -15,6 +15,11 @@
diff --git a/assets/scripts/script.js b/assets/scripts/script.js
index 4a18799..d84fcb5 100644
--- a/assets/scripts/script.js
+++ b/assets/scripts/script.js
@@ -264,6 +264,23 @@ function getSaved(){
}
}
+function getAndrews(){
+ try {
+ const jsonRecipes = GetAndrews();
+ const recipes = JSON.parse(jsonRecipes);
+ console.log("Recipes:", recipes);
+ document.getElementById('andrews-recipe-container').innerHTML = "";
+
+ for (let recipe of recipes) {
+ displayCard(recipe, 'andrews-recipe-container');
+ }
+ } catch (error) {
+ console.error("Error fetching recipes:", error);
+ alert("Failed to fetch recipes. Please try again later.");
+ }
+}
+
+
function getFeatured(){
try {
const jsonRecipes = ShowFeatured();
diff --git a/src/MyApp.cpp b/src/MyApp.cpp
index 1547b72..87462c8 100644
--- a/src/MyApp.cpp
+++ b/src/MyApp.cpp
@@ -321,6 +321,28 @@ JSValue MyApp::GetSaved(const JSObject &thisObject, const JSArgs &args)
return JSValue(jsonRecipes.c_str());
}
+JSValue MyApp::GetAndrews(const JSObject &thisObject, const JSArgs &args)
+{
+ std::cout << "Get saved called" << std::endl;
+ std::vector andrewsList;
+ andrewsList.push_back(496252);
+ andrewsList.push_back(537453);
+ andrewsList.push_back(537034);
+ andrewsList.push_back(540717);
+ std::vector returnAndrews;
+ // std::sort (savedRecipes.begin(), savedRecipes.end());
+ // savedRecipes.erase(std::unique(savedRecipes.begin(), savedRecipes.end(), savedRecipes.end()));
+ RecipeDatabase recipeDB;
+ for (int recipe : andrewsList)
+ {
+ // std::cout << recipe << std::endl;
+ returnAndrews.push_back(recipeDB.getRecipeById(recipe));
+ }
+ std::string jsonRecipes = convertRecipesToJson(returnAndrews);
+
+ return JSValue(jsonRecipes.c_str());
+}
+
JSValue MyApp::ShowFeatured(const JSObject &thisObject, const JSArgs &args){
std::cout<<"show featured called"<< std::endl;
@@ -429,6 +451,7 @@ void MyApp::OnDOMReady(ultralight::View *caller,
global["AddToMealPlanner"] = BindJSCallbackWithRetval(&MyApp::AddToMealPlanner);
global["SaveRecipe"] = BindJSCallback(&MyApp::SaveRecipe);
global["GetSaved"] = BindJSCallbackWithRetval(&MyApp::GetSaved);
+ global["GetAndrews"] = BindJSCallbackWithRetval(&MyApp::GetAndrews);
global["ShowFeatured"] = BindJSCallbackWithRetval(&MyApp::ShowFeatured);
global["GetIngredientsByRecipe"] = BindJSCallbackWithRetval(&MyApp::GetIngredientsByRecipe);
global["GetReviewsByRecipe"] = BindJSCallbackWithRetval(&MyApp::GetReviewsByRecipe);
diff --git a/src/MyApp.h b/src/MyApp.h
index f8c1dc3..2a25c17 100644
--- a/src/MyApp.h
+++ b/src/MyApp.h
@@ -65,6 +65,8 @@ JSValue AddToMealPlanner(const JSObject& thisObject, const JSArgs& args);
JSValue GetSaved(const JSObject& thisObject, const JSArgs& args);
+JSValue GetAndrews(const JSObject& thisObject, const JSArgs& args);
+
JSValue ShowFeatured(const JSObject& thisObject, const JSArgs& args);
void SaveRecipe(const JSObject& thisObject, const JSArgs& args);