Merge branch 'main' of http://113.45.157.195:3003/insiinc/re-mooc
This commit is contained in:
commit
d32c04661f
|
@ -28,8 +28,11 @@ export const NavigationMenu = () => {
|
||||||
}
|
}
|
||||||
}, [isAuthenticated]);
|
}, [isAuthenticated]);
|
||||||
|
|
||||||
const selectedKey =
|
const selectedKey = useMemo(() => {
|
||||||
menuItems.find((item) => item.path === pathname)?.key || "";
|
const normalizePath = (path: string): string => path.replace(/\/$/, "");
|
||||||
|
return pathname === '/' ? "home" : menuItems.find((item) => normalizePath(pathname) === item.path)?.key || "";
|
||||||
|
}, [pathname]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Menu
|
<Menu
|
||||||
mode="horizontal"
|
mode="horizontal"
|
||||||
|
|
Loading…
Reference in New Issue