Trying to get the components to talk to server.
This commit is contained in:
@ -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!
|
||||
|
||||
Reference in New Issue
Block a user