Profile edit (WIP)

This commit is contained in:
Greg Burri 2024-11-15 14:47:10 +01:00
parent 405aa68526
commit 327b2d0a5b
15 changed files with 174 additions and 46 deletions

View file

@ -15,13 +15,15 @@ common = { path = "../common" }
wasm-bindgen = "0.2"
web-sys = { version = "0.3", features = [
'console',
'Document',
'Element',
'HtmlElement',
'Node',
'Window',
'Location',
"console",
"Document",
"Element",
"HtmlElement",
"Node",
"Window",
"Location",
"EventTarget",
"HtmlLabelElement",
] }
# The `console_error_panic_hook` crate provides better debugging of panics by
@ -30,11 +32,6 @@ web-sys = { version = "0.3", features = [
# code size when deploying.
console_error_panic_hook = { version = "0.1", optional = true }
# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
# compared to the default allocator's ~10K. It is slower than the default
# allocator, however.
# wee_alloc = { version = "0.4", optional = true }
# [dev-dependencies]
# wasm-bindgen-test = "0.3"

View file

@ -1,6 +1,10 @@
use wasm_bindgen::prelude::*;
use web_sys::Document;
use web_sys::{Document, HtmlLabelElement};
pub fn edit_recipe(doc: &Document) {
pub fn recipe_edit(doc: &Document) {
let title_input = doc.get_element_by_id("title_field").unwrap();
}
pub fn user_edit(doc: &Document) {
// let name_input = doc.get_element_by_id("name_field").unwrap().dyn_ref::<>()
}

View file

@ -39,7 +39,11 @@ pub fn main() -> Result<(), JsValue> {
let id = id.parse::<i64>().unwrap(); // TODO: remove unwrap.
console_log!("recipe edit ID: {}", id);
handles::edit_recipe(&document);
handles::recipe_edit(&document);
}
["user", "edit"] => {
handles::user_edit(&document);
}
_ => (),
}