Trying to get the components to talk to server.

This commit is contained in:
2025-09-06 22:48:58 -04:00
parent 341d1b329c
commit 2895897e2d
3 changed files with 40 additions and 16 deletions

View File

@ -283,14 +283,14 @@ pub fn PostHeader(title: String, author: String, tags: Vec<String>) -> Element
pub fn BlogPost(slug: String, children: Element) -> Element
{
// 1. Fetch the blog post using the slug.
let post = match use_server_future(move || get_blog_post(slug.clone()))
let post = use_server_future(move ||
{
Ok(post) => { post }
Err(e) =>
let url_slug = slug.clone();
async move
{
return rsx! { p { "Failed to load post." } p { "{e}" } }
get_blog_post(url_slug).await
}
};
})?;
// Then build the component.
rsx!