From 96e3681bf755773673ca866e6959269a81245852 Mon Sep 17 00:00:00 2001 From: alemi Date: Thu, 18 Apr 2024 05:00:26 +0200 Subject: [PATCH] fix(web): play it safe and update auth immediately --- web/src/auth.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/src/auth.rs b/web/src/auth.rs index 58db5eb..1b8969a 100644 --- a/web/src/auth.rs +++ b/web/src/auth.rs @@ -51,7 +51,10 @@ pub fn LoginBox( .json::() .await.unwrap(); logging::log!("logged in until {}", auth.expires); + // update our username and token cookies let username = auth.user.split('/').last().unwrap_or_default().to_string(); + username_tx.set(Some(username.clone())); + token_tx.set(Some(auth.token)); // reset home feed and point it to our user's inbox home_tl.reset(format!("{URL_BASE}/users/{}/inbox/page", username)); spawn_local(async move { @@ -66,9 +69,6 @@ pub fn LoginBox( tracing::error!("failed refreshing server timeline: {e}"); } }); - // update our username and token cookies - username_tx.set(Some(username)); - token_tx.set(Some(auth.token)); }); } />