use leptos::{leptos_dom::logging::console_error, *}; use leptos_router::*; use leptos_use::{use_cookie, utils::JsonCodec}; use upub_web::{ URL_BASE, context::Timeline, About, Auth, LoginBox, MaybeToken, ObjectPage, PostBox, TimelineFeed, TimelineNavigation, UserPage }; fn main() { _ = console_log::init_with_level(log::Level::Debug); console_error_panic_hook::set_once(); let (cookie, set_cookie) = use_cookie::("token"); provide_context(cookie); let home_tl = Timeline::new(format!("{URL_BASE}/users/{}/inbox/page", cookie.get().username())); let server_tl = Timeline::new(format!("{URL_BASE}/inbox/page")); spawn_local(async move { if let Err(e) = server_tl.more(cookie).await { console_error(&format!("error populating timeline: {e}")); } }); if cookie.get().is_some() { spawn_local(async move { if let Err(e) = home_tl.more(cookie).await { console_error(&format!("error populating timeline: {e}")); } }); } mount_to_body( move || view! {

nothing to see here!

}.into_view() > // TODO this is kind of ugly: the whole router gets rebuilt every time we log in/out // in a sense it's what we want: refreshing the home tl is main purpose, but also // server tl may contain stuff we can no longer see, or otherwise we may now be // entitled to see new posts. so while being ugly it's techically correct ig? {move || { view! {


} /> } /> } />
} }} } ); }