'use client'; import { useState } from 'react'; import { useRouter } from 'next/navigation'; import Link from 'next/link'; import { signIn } from '@/lib/auth-client'; export default function LoginPage(): React.ReactElement { const router = useRouter(); const [error, setError] = useState(null); const [loading, setLoading] = useState(false); async function handleSubmit(e: React.FormEvent): Promise { e.preventDefault(); setError(null); setLoading(true); const form = new FormData(e.currentTarget); const email = form.get('email') as string; const password = form.get('password') as string; const result = await signIn.email({ email, password }); if (result.error) { setError(result.error.message ?? 'Sign in failed'); setLoading(false); return; } router.push('/chat'); } return (

Sign in

Sign in to your Mosaic account

{error && (
{error}
)}

Don't have an account?{' '} Sign up

); }