'use client'; import Link from 'next/link'; import { useState } from 'react'; import { Logo } from '@/components/logo'; import { Button } from '@/components/ui/button'; import { Input, Label } from '@/components/input'; import { apiFetch } from '@/lib/api'; export default function LoginPage() { const [email, setEmail] = useState(''); const [state, setState] = useState<'idle' | 'sending' | 'sent' | 'error'>('idle'); const [error, setError] = useState(null); async function submit(e: React.FormEvent) { e.preventDefault(); setState('sending'); setError(null); try { await apiFetch('/v1/auth/magic-link', { method: 'POST', body: JSON.stringify({ email }), }); setState('sent'); } catch (err) { setState('error'); setError((err as Error).message); } } return (

Sign in to your workspace

We'll email you a magic link. No password.

{state !== 'sent' ? (
setEmail(e.target.value)} placeholder="you@company.com" />
{error &&

{error}

}
) : (

Magic link sent to {email}.

In dev mode the link is printed to the API console output. Check the terminal.

)}
← Back to home
); }