import * as React from 'react';
import { Navigate, Outlet } from 'react-router-dom';
import { isAuthenticated } from '@/lib/auth';

/** Redirects to /dashboard/login if not authenticated. */
export function RequireAuth(): React.JSX.Element {
  if (!isAuthenticated()) {
    return <Navigate to="/dashboard/login" replace />;
  }
  return <Outlet />;
}
