import { redirect } from "react-router";
import SignUp from "~/components/signup";
import type { Route } from "../+types/root";
import { auth } from "../../lib/auth";

export async function loader({ request }: Route.LoaderArgs) {
  const session = await auth.api.getSession({
    headers: request.headers,
  });

  if (session) {
    throw redirect("/");
  }

  return null;
}

export default function SignUpPage() {
  return <SignUp />;
}
