import { useEffect, useState } from 'react'; import { useSearchParams } from 'react-router-dom'; import { Button } from '@/components/ui/button'; import { AlertCircle } from 'lucide-react'; export default function AuthErrorPage() { const [searchParams] = useSearchParams(); const [countdown, setCountdown] = useState(3); const errorMessage = searchParams.get('msg') || 'Sorry, your authentication information is invalid or has expired'; useEffect(() => { // Countdown logic const timer = setInterval(() => { setCountdown(prev => { if (prev <= 1) { clearInterval(timer); // Redirect to home page window.location.href = '/'; return 0; } return prev - 1; }); }, 1000); // Clean up timer return () => clearInterval(timer); }, []); const handleReturnHome = () => { window.location.href = '/'; }; return (
{errorMessage}
{/* Countdown message */}{countdown > 0 ? ( <> Will automatically return to the home page in{' '} {countdown} {' '} seconds > ) : ( 'Redirecting...' )}