mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
Merge pull request #4743 from BerriAI/ui_fix_logout
[UI] Clear cookies on logging out
This commit is contained in:
commit
5153692a56
2 changed files with 10 additions and 6 deletions
|
|
@ -31,6 +31,9 @@ const Sidebar: React.FC<SidebarProps> = ({
|
|||
<Menu.Item key="1" onClick={() => setPage("usage")}>
|
||||
Usage
|
||||
</Menu.Item>
|
||||
<Menu.Item key="9" onClick={() => setPage("caching")}>
|
||||
<Text>Caching</Text>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
</Sider>
|
||||
</Layout>
|
||||
|
|
|
|||
|
|
@ -57,7 +57,12 @@ const Navbar: React.FC<NavbarProps> = ({
|
|||
|
||||
console.log("logoutUrl=", logoutUrl);
|
||||
|
||||
|
||||
const handleLogout = () => {
|
||||
// Clear cookies
|
||||
document.cookie = "token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
||||
window.location.href = logoutUrl;
|
||||
}
|
||||
|
||||
|
||||
const items: MenuProps["items"] = [
|
||||
{
|
||||
|
|
@ -72,11 +77,7 @@ const Navbar: React.FC<NavbarProps> = ({
|
|||
},
|
||||
{
|
||||
key: "2",
|
||||
label: (
|
||||
<a href={logoutUrl}>
|
||||
<p>Logout</p>
|
||||
</a>
|
||||
),
|
||||
label: <p onClick={handleLogout}>Logout</p>,
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue