Recipe edit (WIP): forms to edit groups, steps and ingredients

This commit is contained in:
Greg Burri 2024-12-26 01:39:07 +01:00
parent dd05a673d9
commit 07b7ff425e
25 changed files with 881 additions and 203 deletions

View file

@ -1,10 +1,10 @@
mod handles;
mod request;
mod toast;
mod utils;
use gloo::{console::log, events::EventListener, utils::window};
use gloo::utils::window;
use wasm_bindgen::prelude::*;
use web_sys::console;
// #[wasm_bindgen]
// extern "C" {
@ -27,17 +27,14 @@ pub fn main() -> Result<(), JsValue> {
let location = window().location().pathname()?;
let path: Vec<&str> = location.split('/').skip(1).collect();
match path[..] {
["recipe", "edit", id] => {
let id = id.parse::<i64>().unwrap(); // TODO: remove unwrap.
handles::recipe_edit(id)?;
}
if let ["recipe", "edit", id] = path[..] {
let id = id.parse::<i64>().unwrap(); // TODO: remove unwrap.
handles::recipe_edit(id)?;
// Disable: user editing data are now submitted as classic form data.
// ["user", "edit"] => {
// handles::user_edit(document)?;
// }
_ => (),
}
Ok(())