add
This commit is contained in:
parent
2f39ecea3c
commit
3c9609c0a4
|
@ -27,8 +27,11 @@ export const NavigationMenu = () => {
|
|||
}
|
||||
}, [isAuthenticated]);
|
||||
|
||||
const selectedKey =
|
||||
menuItems.find((item) => item.path === pathname)?.key || "";
|
||||
const selectedKey = useMemo(() => {
|
||||
const normalizePath = (path: string): string => path.replace(/\/$/, "");
|
||||
return pathname === '/' ? "home" : menuItems.find((item) => normalizePath(pathname) === item.path)?.key || "";
|
||||
}, [pathname]);
|
||||
|
||||
return (
|
||||
<Menu
|
||||
mode="horizontal"
|
||||
|
|
Loading…
Reference in New Issue