diff --git a/src/webpage.rs b/src/webpage.rs index bc2b339..fbde05c 100644 --- a/src/webpage.rs +++ b/src/webpage.rs @@ -11,7 +11,7 @@ pub struct Config { pub fn App() -> impl IntoView { let (count, set_count) = signal(0); let config = LocalResource::new(load_config); - + view! {
@@ -23,8 +23,14 @@ pub fn App() -> impl IntoView { } } - - -async fn load_config() -> std::result::Result { - Request::get("/config.json").send().await?.json::().await +async fn load_config() -> std::result::Result { + let response = Request::get("/config.json") + .send() + .await + .map_err(|e| format!("HTTP error: {e}"))?; + let config = response + .json::() + .await + .map_err(|e| format!("JSON error: {e}"))?; + Ok(config) }