remove dead code

This commit is contained in:
Felix Ableitner 2024-01-29 15:50:21 +01:00
parent 117323a5e3
commit 7a1da4fd34
2 changed files with 1 additions and 10 deletions

View File

@ -22,19 +22,11 @@ use reqwest::Client;
// https://book.leptos.dev/15_global_state.html // https://book.leptos.dev/15_global_state.html
#[derive(Clone)] #[derive(Clone)]
pub struct GlobalState { pub struct GlobalState {
// TODO: remove
backend_hostname: String,
api_client: ApiClient, api_client: ApiClient,
pub(crate) my_profile: Option<LocalUserView>, pub(crate) my_profile: Option<LocalUserView>,
} }
impl GlobalState { impl GlobalState {
pub fn read_hostname() -> String {
use_context::<RwSignal<GlobalState>>()
.expect("backend hostname is provided")
.get_untracked()
.backend_hostname
}
pub fn api_client() -> ApiClient { pub fn api_client() -> ApiClient {
use_context::<RwSignal<GlobalState>>() use_context::<RwSignal<GlobalState>>()
.expect("global state is provided") .expect("global state is provided")
@ -60,7 +52,6 @@ pub fn App() -> impl IntoView {
provide_meta_context(); provide_meta_context();
let backend_hostname = GlobalState { let backend_hostname = GlobalState {
backend_hostname: backend_hostname.clone(),
api_client: ApiClient::new(Client::new(), backend_hostname.clone()), api_client: ApiClient::new(Client::new(), backend_hostname.clone()),
my_profile: None, my_profile: None,
}; };

View File

@ -6,7 +6,7 @@ use leptos_router::*;
#[component] #[component]
pub fn ArticleHistory() -> impl IntoView { pub fn ArticleHistory() -> impl IntoView {
let params = use_params_map(); let params = use_params_map();
let title = params.get().get("title").cloned(); let title = params.get_untracked().get("title").cloned();
let article = article_resource(title.unwrap()); let article = article_resource(title.unwrap());
view! { view! {