forked from phoenix/litellm-mirror
update menu history
This commit is contained in:
parent
adc3c0beb7
commit
52a9cfa029
1 changed files with 12 additions and 4 deletions
|
@ -7,7 +7,7 @@ const { Sider } = Layout;
|
||||||
|
|
||||||
// Define the props type
|
// Define the props type
|
||||||
interface SidebarProps {
|
interface SidebarProps {
|
||||||
setPage: React.Dispatch<React.SetStateAction<string>>;
|
setPage: (page: string) => void;
|
||||||
userRole: string;
|
userRole: string;
|
||||||
defaultSelectedKey: string;
|
defaultSelectedKey: string;
|
||||||
}
|
}
|
||||||
|
@ -67,9 +67,17 @@ const Sidebar: React.FC<SidebarProps> = ({
|
||||||
style={{ height: "100%", borderRight: 0 }}
|
style={{ height: "100%", borderRight: 0 }}
|
||||||
>
|
>
|
||||||
{filteredMenuItems.map(item => (
|
{filteredMenuItems.map(item => (
|
||||||
<Menu.Item key={item.key} onClick={() => setPage(item.page)}>
|
<Menu.Item
|
||||||
<Text>{item.label}</Text>
|
key={item.key}
|
||||||
</Menu.Item>
|
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>
|
</Menu>
|
||||||
</Sider>
|
</Sider>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue