Add a RON API to search recipes by title + a bit of refactoring

This commit is contained in:
Greg Burri 2025-05-21 19:58:31 +02:00
parent a3f61e3711
commit 084f7ef445
26 changed files with 499 additions and 333 deletions

View file

@ -1,7 +1,7 @@
use std::{cell::RefCell, rc::Rc};
use chrono::{Datelike, Days, Months, NaiveDate, Weekday, offset::Local};
use common::{ron_api, utils::substitute_with_names};
use common::{web_api, utils::substitute_with_names};
use gloo::{
events::EventListener,
utils::{document, window},
@ -13,7 +13,7 @@ use web_sys::{Element, HtmlInputElement};
use crate::{
modal_dialog,
recipe_scheduler::RecipeScheduler,
request,
ron_request,
utils::{SelectorExt, by_id, get_locale, selector, selector_all},
};
@ -167,12 +167,14 @@ pub fn setup(
)
.await
{
let body = ron_api::RemoveScheduledRecipe {
let body = web_api::RemoveScheduledRecipe {
recipe_id,
date,
remove_ingredients_from_shopping_list,
};
let _ = request::delete::<(), _>("calendar/scheduled_recipe", Some(body)).await;
let _ =
ron_request::delete::<(), _>("/ron-api/calendar/scheduled_recipe", Some(body))
.await;
window().location().reload().unwrap();
}
});