mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
fix(ui): preserve sessionStorage token across beforeunload clear
The existing beforeunload handler calls sessionStorage.clear() to flush cached UI data on page refresh. This also wiped the token stored by storeLoginToken, re-introducing the redirect loop after any page refresh in the HttpOnly proxy scenario. Now the token is saved and restored across the clear. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
35bd69e146
commit
01f8844114
1 changed files with 4 additions and 0 deletions
|
|
@ -97,7 +97,11 @@ const UserDashboard: React.FC<UserDashboardProps> = ({
|
|||
// They are only cleared on logout
|
||||
useEffect(() => {
|
||||
const handleBeforeUnload = () => {
|
||||
const token = sessionStorage.getItem("token");
|
||||
sessionStorage.clear();
|
||||
if (token) {
|
||||
sessionStorage.setItem("token", token);
|
||||
}
|
||||
};
|
||||
window.addEventListener("beforeunload", handleBeforeUnload);
|
||||
return () => window.removeEventListener("beforeunload", handleBeforeUnload);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue