+ //let body = document.body().expect("document should have a body");
+
+ let location = window.location().pathname()?;
+ let path: Vec<&str> = location.split('/').skip(1).collect();
+
+ /*
+ * Todo:
+ * [ok] get url (/recipe/edit/{id}) and extract the id
+ * - Add a handle (event?) to the title field (when edited/changed?):
+ * - 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);
+
+ handles::edit_recipe(&document);
+
+ let title_input = document.get_element_by_id("title_field").unwrap();
+ },
+ _ => (),
+ }