fix active sidebar item
This commit is contained in:
@@ -20,8 +20,10 @@ const SideBar: FC = () => {
|
||||
const { openSidebar, setOpenSidebar, hasSubMenu, setSubMenuName, setSubtMenu, subMenuName } = useSharedStore()
|
||||
const location = useLocation()
|
||||
|
||||
const isActive = (name: string) => {
|
||||
return window.location.href.includes(name)
|
||||
const isActive = (path: string) => {
|
||||
const pathname = location.pathname
|
||||
if (path === '/') return pathname === '/'
|
||||
return pathname === path || pathname.startsWith(path + '/')
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user