'use client'; import { useState } from 'react'; import { useRouter, Link } from '@/core/lib/navigation'; import { useAuth } from '@/core/providers/store-provider'; import { proxyLogin } from '@/core/lib/auth'; import { LoginForm } from '@/components/auth/login-form'; import { OAuthButtons } from '@/components/auth/oauth-buttons'; import { useTranslations } from '@/core/lib/translations'; export default function LoginPage() { const router = useRouter(); const auth = useAuth(); const t = useTranslations('auth'); const [error, setError] = useState(null); async function handleLogin(email: string, password: string) { try { setError(null); const result = await proxyLogin(email, password); if (result.requiresVerification) { // Verification token is NOT the auth JWT — safe to pass in URL router.push('/verify-email'); return; } // Cookie was set by the proxy; refresh auth state await auth.login(); router.push('/'); } catch (err) { const message = err instanceof Error ? err.message : 'Login failed. Please try again.'; setError(message); } } return (

{t('welcomeBack')}

{t('signInSubtitle')}

{t('noAccount')}{' '} {t('createOne')}

); }