import { signIn } from '@/auth'; import LabeledInput from '@/components/labeled-input'; import { Button } from '@/components/ui/button'; import { AuthError } from 'next-auth'; import { redirect } from 'next/navigation'; const SIGNIN_ERROR_URL = '/error'; export default function LoginForm() { return (
{ 'use server'; try { await signIn('credentials', formData); } catch (error) { if (error instanceof AuthError) { return redirect(`${SIGNIN_ERROR_URL}?error=${error.type}`); } throw error; } }} > ); }