import { redirect } from 'next/navigation';
import { LoginCard } from '@/components/auth/login-card';
import { getSession } from '@/lib/session';

interface HomePageProps {
  searchParams: Promise<{ error?: string }>;
}

export default async function HomePage({ searchParams }: HomePageProps) {
  const session = await getSession();
  if (session) {
    redirect('/dashboard');
  }

  const { error } = await searchParams;
  return <LoginCard error={error} />;
}
