"use client"; import { post } from "@/api/request"; import { useSearchParams } from "next/navigation"; import React, { useEffect, useState } from "react"; import { CheckCircle, XCircle, Loader2 } from "lucide-react"; export default function Activate() { const searchParams = useSearchParams(); const t = searchParams.get("t") || ""; const type = searchParams.get("type"); if (type === "confirm_email") { return ; } return <>; } /** * Email verification confirmation component * @param {string} t - Verification token */ function ConfirmEmail({ t }: { t: string }) { const [status, setStatus] = useState<"loading" | "success" | "error">( "loading" ); const [message, setMessage] = useState(""); useEffect(() => { if (!t) { setStatus("error"); setMessage("Invalid verification token"); return; } post(`/auth/activate`, { t: t, }).then((res:any) => { console.log('res', res) setStatus("success"); setMessage( "Your registration has been verified. Please return to the official website to log in." ); }).catch((err:any) => { console.log('err', err) setStatus("error"); setMessage("Verification failed. Please try again."); }); }, [t]); const renderContent = () => { switch (status) { case "loading": return (

Verifying email...

); case "success": return (

Verification Successful

{message}

); case "error": return (

Verification Failed

{message}

{/* */}
); } }; return (
{status === "loading" && (

Email Verification

Please wait while we verify your email

)} {renderContent()}
); }