import type { ReactElement } from 'react';
import { matchPath, useLocation } from 'react-router-dom';
import { AdminRouter } from '@/components/AdminRouter';
import { UserRouter } from '@/components/UserRouter';
import { PATHS, type Router } from '@/constants';
} satisfies Record<Role, ReactElement>;
export default function RootRouter() {
const { pathname } = useLocation();
const { isAuthenticated, role } = useAuth(); // 認証状態を返すダミーHook
const existsPath = Object.values(PATHS).some(
(path) => !!matchPath(path, pathname),
if (!existsPath) return <NotFoundPage />;
if (!isAuthenticated) return <Navigate to={PATH.SIGNIN} />;