fix: getCurrentMenu 함수 수정
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user