fix router

This commit is contained in:
Proddy
2023-11-26 15:56:46 +01:00
parent 1cbfc91912
commit 76901d97d2
16 changed files with 70 additions and 63 deletions

View File

@@ -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;
};