diff --git a/crates/site-app/src/pages/mod.rs b/crates/site-app/src/pages/mod.rs index 5bfdf6e..bcd3597 100644 --- a/crates/site-app/src/pages/mod.rs +++ b/crates/site-app/src/pages/mod.rs @@ -1,9 +1,28 @@ -use leptos::prelude::*; +use leptos::{either::Either, prelude::*}; use crate::components::Section; #[component] pub fn HomePage() -> impl IntoView { + let fallback = move || { + view! { +
"Loading photos..."
+ } + }; + let photos = Resource::new(|| (), |_| enumerate_photos()); + let photos_suspense_viewer = move || { + Suspend::new(async move { + match photos.await { + Ok(photos) => Either::Left(view! { +{ format!("{photos:#?}") }+ }), + Err(e) => Either::Right(view! { +
{ format!("{e}") }+ }), + } + }) + }; + view! {
@@ -12,6 +31,16 @@ pub fn HomePage() -> impl IntoView {
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Duo Reges: constructio interrete. Quae cum dixisset, finem ille."
+