give slingshot the path (change later (maybe (hopefully)))

This commit is contained in:
Adam 2024-01-18 17:38:43 -05:00
parent 30f3ee0696
commit 7a98b2c3c4

View file

@ -1,10 +1,14 @@
use crate::components::article::*; use crate::components::article::*;
use crate::components::slingshot::*; use crate::components::slingshot::*;
use crate::error_template::*;
use leptos::*; use leptos::*;
#[component] #[component]
pub fn Home() -> impl IntoView { pub fn Home() -> impl IntoView {
let data_resource = create_local_resource(|| (), |_| async move { slingshot().await }); let data_resource = create_local_resource(
|| (),
|_| async move { slingshot("./public/static".to_string()).await },
);
let articles_view = move || { let articles_view = move || {
data_resource.and_then(|data| { data_resource.and_then(|data| {
@ -17,6 +21,10 @@ pub fn Home() -> impl IntoView {
view! { view! {
<Suspense fallback=move || { <Suspense fallback=move || {
view! { <p>"Loading..."</p> } view! { <p>"Loading..."</p> }
}>{articles_view}</Suspense> }>
<ErrorBoundary fallback=|errors| {
view! { <ErrorTemplate errors=errors/> }
}>{articles_view}</ErrorBoundary>
</Suspense>
} }
} }