Dispaly a user message when a recipe is successfully deleted

This commit is contained in:
Greg Burri 2025-05-05 23:28:17 +02:00
parent d86c8ab6fe
commit ec36391ec8
6 changed files with 182 additions and 166 deletions

View file

@ -262,11 +262,19 @@ pub fn setup_page(recipe_id: i64) {
.is_some()
{
let body = ron_api::Id { id: recipe_id };
let _ = request::delete::<(), _>("recipe", body).await;
window()
.location()
.set_href(&format!("/{}/", get_current_lang()))
.unwrap();
if let Ok(()) = request::delete::<(), _>("recipe", body).await {
window()
.location()
.set_href(&format!(
"/{}/?{}={}&{}={}",
get_current_lang(),
common::consts::GET_PARAMETER_USER_MESSAGE,
common::translation::Sentence::RecipeSuccessfullyDeleted as i64,
common::consts::GET_PARAMETER_USER_MESSAGE_LEVEL,
common::toast::Level::Success as usize
))
.unwrap();
}
}
});
})