mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
fix router
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { useMatch, useResolvedPath } from 'react-router-dom';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
|
||||
export const useRouterTab = () => {
|
||||
const routerTabPath = useResolvedPath(':tab');
|
||||
const routerTabPathMatch = useMatch(routerTabPath.pathname);
|
||||
const loc = useLocation().pathname;
|
||||
const routerTab = loc.substring(0, loc.lastIndexOf('/')) ? loc : false;
|
||||
|
||||
const routerTab = routerTabPathMatch?.params?.tab || false;
|
||||
return { routerTab } as const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user