From: Greg Burri <greg.burri@gmail.com> Date: Tue, 31 Dec 2024 10:31:11 +0000 (+0100) Subject: Go to home after recipe delete X-Git-Url: https://git.euphorik.ch/?a=commitdiff_plain;h=b5919a43eb2ed61da807ae1b05dee28ac5d4101d;p=recipes.git Go to home after recipe delete --- diff --git a/frontend/src/handles.rs b/frontend/src/handles.rs index ac71751..3097ea2 100644 --- a/frontend/src/handles.rs +++ b/frontend/src/handles.rs @@ -1,4 +1,9 @@ -use gloo::{console::log, events::EventListener, net::http::Request, utils::document}; +use gloo::{ + console::log, + events::EventListener, + net::http::Request, + utils::{document, window}, +}; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::spawn_local; use web_sys::{ @@ -206,6 +211,7 @@ pub fn recipe_edit(recipe_id: i64) -> Result<(), JsValue> { { let body = ron_api::Remove { recipe_id }; let _ = request::delete::<(), _>("recipe/remove", body).await; + window().location().set_href("/").unwrap(); // by_id::<Element>(&format!("group-{}", group_id)).remove(); }