'use client' import { Suspense, useEffect, useState } from 'react' import { useSearchParams, useRouter } from 'next/navigation' import { motion } from 'framer-motion' function VerifyContent() { const searchParams = useSearchParams() const router = useRouter() const token = searchParams.get('token') const [status, setStatus] = useState<'verifying' | 'success' | 'error'>('verifying') const [errorMsg, setErrorMsg] = useState('') useEffect(() => { if (!token) { setStatus('error') setErrorMsg('No access token provided.') return } async function verify() { try { // If the investor already has a valid session, skip token verification const sessionCheck = await fetch('/api/auth/me') if (sessionCheck.ok) { router.push('/') return } const res = await fetch('/api/auth/verify', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ token }), }) if (res.ok) { setStatus('success') setTimeout(() => router.push('/'), 1000) } else { const data = await res.json() setStatus('error') setErrorMsg(data.error || 'Verification failed.') } } catch { setStatus('error') setErrorMsg('Network error. Please try again.') } } verify() }, [token, router]) return (
{status === 'verifying' && ( <>

Verifying your access link...

)} {status === 'success' && ( <>

Access verified!

Redirecting to pitch deck...

)} {status === 'error' && ( <>

Access Denied

{errorMsg}

Back to login )}
) } export default function VerifyPage() { return (

Loading...

} >
{/* Privacy Notice Footer */}

Datenschutzhinweis: Beim Zugriff auf diese Seite werden technische Zugriffsdaten (insbesondere IP-Adresse und Zeitpunkt) verarbeitet, um die sichere Nutzung des Zugangs zu gewährleisten und Missbrauch zu verhindern. Die Speicherung erfolgt für maximal 72 Stunden. Rechtsgrundlage: Art. 6 Abs. 1 lit. f DSGVO (berechtigtes Interesse). Weitere Informationen zum Datenschutz erhalten Sie auf Anfrage.

Verantwortlich: Benjamin Bönisch & Sharang Parnerkar · Kontakt: info@breakpilot.com

) }