}.into()
})
}
}
}
#[derive(Deserialize, Serialize, Clone, Debug, Default)]
pub struct ResumeTranslations {
content: String
}
#[derive(Deserialize, Serialize, Clone, Debug)]
pub struct ResumeSingleton {
translations: Option
}
#[server(GetResume, "/api", "GetJson")]
pub async fn get_resume(locale: String) -> Result {
crate::services::directus::get_client()
.get_item::(&locale, "resume", "resume").await
.map_err(|e| ServerFnError::ServerError(e.to_string()))
}
#[component]
pub fn Resume() -> impl IntoView {
let i18n = use_i18n();
let resume = Resource::new(move || i18n.get_locale(), move |locale| get_resume(locale.to_string()));
view! {
"Loading..."
}
>
{move || resume.get()
.and_then(|resume| resume.ok())
.and_then(|resume| {
let html = markdown::to_html(&resume.translations.unwrap_or_default().content);
view! {
}.into()
})
}
}
}