fix(web): play it safe and update auth immediately
This commit is contained in:
parent
85f3bc1e5c
commit
96e3681bf7
1 changed files with 3 additions and 3 deletions
|
@ -51,7 +51,10 @@ pub fn LoginBox(
|
|||
.json::<AuthResponse>()
|
||||
.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));
|
||||
});
|
||||
} />
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue