'use client'; import React, { useState, useEffect } from 'react' import { resendVerification } from '@/app/API/auth/register'; import Image from 'next/image'; const VerificationPending = () => { const [message, setMessage] = useState(''); const [loading, setLoading] = useState(false); const [countdown, setCountdown] = useState(0); const email = typeof window !== 'undefined' ? new URLSearchParams(window.location.search).get('email') : ''; useEffect(() => { let timer: NodeJS.Timeout; if (countdown > 0) { timer = setInterval(() => { setCountdown(prev => prev - 1); }, 1000); } return () => clearInterval(timer); }, [countdown]); const handleResendEmail = async () => { if (!email || countdown > 0) return; setLoading(true); try { const response = await resendVerification(email); setMessage(response.message || 'Verification email sent successfully'); setCountdown(30); } catch (error: any) { setMessage(error.message || 'Failed to resend verification email. Please try again later.'); console.error('Resend error:', error); } finally { setLoading(false); } }; return (
Store Logo

Check Your Email

We've sent a verification link to

{email}

{message && (
{message}
)}

Didn't receive the email? Check your spam folder or try resending.

); }; export default VerificationPending;