import { createRootRoute, Navigate, Outlet } from '@tanstack/react-router';
import { tokenStorage } from '@/infrastructure/storage/LocalTokenStorage';

export const Route = createRootRoute({
  component: () => (
    <div className="bg-background">
      <Outlet />
    </div>
  ),
  notFoundComponent: () => {
    const to = tokenStorage.hasTokens() ? '/dashboard' : '/login';
    return <Navigate to={to} />;
  },
});
