diff --git a/crates/ui/src/lib.rs b/crates/ui/src/lib.rs index eeaf6c1..1813290 100644 --- a/crates/ui/src/lib.rs +++ b/crates/ui/src/lib.rs @@ -1,4 +1,8 @@ -use crate::{api::resolve_ingredients, routing::Route, state::AppState}; +use crate::{ + api::{resolve_ingredients, resolve_recipes}, + routing::Route, + state::AppState, +}; use dioxus::prelude::*; use dioxus_router::components::Router; use wasm_bindgen::prelude::*; @@ -16,12 +20,14 @@ fn init_wasm() -> Result<(), JsValue> { #[wasm_bindgen] pub fn launch_app() { + wasm_logger::init(wasm_logger::Config::default()); dioxus_web::launch(app); } fn app(cx: Scope) -> Element { use_shared_state_provider(cx, AppState::default); let app_state = use_shared_state::(cx).unwrap(); + use_future(cx, (), |_| resolve_recipes(app_state.clone())); use_future(cx, (), |_| resolve_ingredients(app_state.clone())); render! { diff --git a/crates/ui/src/routing.rs b/crates/ui/src/routing.rs index 0f10427..4125796 100644 --- a/crates/ui/src/routing.rs +++ b/crates/ui/src/routing.rs @@ -1,5 +1,4 @@ use crate::{ - api::resolve_recipes, components::{IngredientCreate, Recipe, RecipeCreate}, state::AppState, util, @@ -122,7 +121,6 @@ pub(crate) fn AppIndex(cx: Scope) -> Element { #[allow(non_snake_case)] pub(crate) fn AppRecipes(cx: Scope) -> Element { let app_state = use_shared_state::(cx).unwrap(); - use_future(cx, (), |_| resolve_recipes(app_state.clone())); let creating_recipe = use_state(cx, || false);