Testing out the Author now.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "bard"
|
||||
version = "0.0.9"
|
||||
version = "0.0.10"
|
||||
edition = "2024"
|
||||
description = "Dioxus components that will display a Tavern blogging system Blog."
|
||||
repository = "/CyberMages/tavern"
|
||||
|
||||
@ -224,10 +224,15 @@ pub fn PostHeaderAuthor(name: String, handle: String, profile_link: String) -> E
|
||||
#[component]
|
||||
pub fn PostHeader(title: String, author: String, tags: Vec<String>) -> Element
|
||||
{
|
||||
let Ok(author) = use_server_future(move || get_author(author.clone())) else
|
||||
let author = use_server_future(move ||
|
||||
{
|
||||
return rsx! { p { "Failed to load author." } }
|
||||
};
|
||||
let target_author = author.clone();
|
||||
async move
|
||||
{
|
||||
get_author(target_author).await
|
||||
}
|
||||
})?;
|
||||
|
||||
|
||||
rsx!
|
||||
{
|
||||
@ -282,8 +287,6 @@ pub fn PostHeader(title: String, author: String, tags: Vec<String>) -> Element
|
||||
#[component]
|
||||
pub fn BlogPost(slug: String, children: Element) -> Element
|
||||
{
|
||||
let test_slug = slug.clone();
|
||||
// 1. Fetch the blog post using the slug.
|
||||
let post = use_server_future(move ||
|
||||
{
|
||||
let url_slug = slug.clone();
|
||||
@ -293,7 +296,6 @@ pub fn BlogPost(slug: String, children: Element) -> Element
|
||||
}
|
||||
})?;
|
||||
|
||||
// Then build the component.
|
||||
rsx!
|
||||
{
|
||||
document::Link { rel: "stylesheet", href: POST_CSS }
|
||||
@ -324,7 +326,6 @@ pub fn BlogPost(slug: String, children: Element) -> Element
|
||||
rsx!
|
||||
{
|
||||
p { "Unable to show desired post." }
|
||||
p { "Trying to get: {test_slug}" }
|
||||
p { "{e}" }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user