give slingshot the path (change later (maybe (hopefully)))
This commit is contained in:
parent
30f3ee0696
commit
7a98b2c3c4
1 changed files with 12 additions and 4 deletions
|
@ -1,22 +1,30 @@
|
|||
use crate::components::article::*;
|
||||
use crate::components::slingshot::*;
|
||||
use crate::error_template::*;
|
||||
use leptos::*;
|
||||
|
||||
#[component]
|
||||
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 || {
|
||||
data_resource.and_then(|data| {
|
||||
data.iter()
|
||||
.map(|article| view! { <Article data=article.to_owned()/> })
|
||||
.collect_view()
|
||||
.map(|article| view! { <Article data=article.to_owned()/> })
|
||||
.collect_view()
|
||||
})
|
||||
};
|
||||
|
||||
view! {
|
||||
<Suspense fallback=move || {
|
||||
view! { <p>"Loading..."</p> }
|
||||
}>{articles_view}</Suspense>
|
||||
}>
|
||||
<ErrorBoundary fallback=|errors| {
|
||||
view! { <ErrorTemplate errors=errors/> }
|
||||
}>{articles_view}</ErrorBoundary>
|
||||
</Suspense>
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue