tweak `useRouterBasePath`
parent
e593f61363
commit
bb4710a0b8
|
@ -16,14 +16,14 @@ import Loader from "@components/Loader";
|
||||||
function useRouterBasePath() {
|
function useRouterBasePath() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
return useMemo(() => {
|
return useMemo(() => {
|
||||||
const path = router.asPath.split("/");
|
const path = router.asPath.split("/").filter(Boolean);
|
||||||
|
|
||||||
// For teams
|
// For teams
|
||||||
if (path.length > 3) {
|
if (path[0] === "team") {
|
||||||
return `${path[1]}/${path[2]}`;
|
return `${path[0]}/${path[1]}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return path[1] as string;
|
return path[0] as string;
|
||||||
}, [router.asPath]);
|
}, [router.asPath]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue