mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
(UI fix) UI does not reload when you login / open a new tab (#6909)
* store current page on url * update menu history
This commit is contained in:
parent
2bb2f7b1e1
commit
f6074c9af0
2 changed files with 32 additions and 14 deletions
|
@ -7,7 +7,7 @@ const { Sider } = Layout;
|
|||
|
||||
// Define the props type
|
||||
interface SidebarProps {
|
||||
setPage: React.Dispatch<React.SetStateAction<string>>;
|
||||
setPage: (page: string) => void;
|
||||
userRole: string;
|
||||
defaultSelectedKey: string;
|
||||
}
|
||||
|
@ -67,9 +67,17 @@ const Sidebar: React.FC<SidebarProps> = ({
|
|||
style={{ height: "100%", borderRight: 0 }}
|
||||
>
|
||||
{filteredMenuItems.map(item => (
|
||||
<Menu.Item key={item.key} onClick={() => setPage(item.page)}>
|
||||
<Text>{item.label}</Text>
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
key={item.key}
|
||||
onClick={() => {
|
||||
const newSearchParams = new URLSearchParams(window.location.search);
|
||||
newSearchParams.set('page', item.page);
|
||||
window.history.pushState(null, '', `?${newSearchParams.toString()}`);
|
||||
setPage(item.page);
|
||||
}}
|
||||
>
|
||||
<Text>{item.label}</Text>
|
||||
</Menu.Item>
|
||||
))}
|
||||
</Menu>
|
||||
</Sider>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue