'use client'; import { Suspense, useState } from 'react'; import { useSearchParams } from 'next/navigation'; import { authClient } from '@/app/lib/auth-client'; export default function LoginPage() { return (
Loading…
}>
); } function safe(next: string | null) { return next && next.startsWith('/') && !next.startsWith('//') ? next : '/orders'; } function PasskeySignIn() { const params = useSearchParams(); const next = safe(params.get('next')); const [busy, setBusy] = useState(false); const [error, setError] = useState(params.get('error') === 'link_expired' ? 'That private link has expired. Use the newest link in your order email.' : null); async function signIn() { setBusy(true); setError(null); try { const res = await authClient.signIn.passkey(); if (res?.error) setError('That passkey didn’t work here. Try again, or open the private link in your order email.'); else window.location.assign(next); } catch { setError('We couldn’t reach the studio. Try again in a moment.'); } finally { setBusy(false); } } return (

Sign in

Use your passkey: Face ID, Touch ID or your phone. There are no passwords.

{error &&

{error}

}

New here? Your order email has a private link to your portrait. Open it once and save a passkey.

); }