fix: getCurrentMenu 함수 수정

This commit is contained in:
2025-04-07 17:38:37 +09:00
parent 9a2bdfc0ca
commit 2797ec210e
+5 -3
View File
@@ -5,10 +5,12 @@ export const getCurrentMenu = (
pathname: string,
): MenuItem | null => {
for (const menu of menus) {
if (menu.children) {
return getCurrentMenu(menu.children, pathname);
}
if (menu.urlPath === pathname) return menu;
if (menu.children) {
const children = getCurrentMenu(menu.children, pathname);
if (children) return children;
}
}
return null;
};