* Create a minimalistic toast

* Profile editing (WIP)
This commit is contained in:
Greg Burri 2024-12-04 17:39:56 +01:00
parent 327b2d0a5b
commit 1c79cc890d
25 changed files with 1133 additions and 575 deletions

View file

@ -1,19 +1,21 @@
mod handles;
mod toast;
mod utils;
use gloo::{console::log, events::EventListener};
use wasm_bindgen::prelude::*;
use web_sys::console;
#[wasm_bindgen]
extern "C" {
fn alert(s: &str);
}
// #[wasm_bindgen]
// extern "C" {
// fn alert(s: &str);
// }
#[wasm_bindgen]
pub fn greet(name: &str) {
alert(&format!("Hello, {}!", name));
console::log_1(&"Hello bg".into());
}
// #[wasm_bindgen]
// pub fn greet(name: &str) {
// alert(&format!("Hello, {}!", name));
// console::log_1(&"Hello bg".into());
// }
#[wasm_bindgen(start)]
pub fn main() -> Result<(), JsValue> {
@ -33,17 +35,16 @@ pub fn main() -> Result<(), JsValue> {
* - Call (as AJAR) /ron-api/set-title and set the body to a serialized RON of the type common::ron_api::SetTitle
* - Display error message if needed
*/
match path[..] {
["recipe", "edit", id] => {
let id = id.parse::<i64>().unwrap(); // TODO: remove unwrap.
console_log!("recipe edit ID: {}", id);
log!("recipe edit ID: {}", id);
handles::recipe_edit(&document);
handles::recipe_edit(document)?;
}
["user", "edit"] => {
handles::user_edit(&document);
handles::user_edit(document)?;
}
_ => (),
}