diff --git a/src/app/verify-email/page.tsx b/src/app/verify-email/page.tsx deleted file mode 100644 index 0892bd4..0000000 --- a/src/app/verify-email/page.tsx +++ /dev/null @@ -1,62 +0,0 @@ -"use client"; - -import getErrorMessage from "@/utils/getErrorMessage"; -import axios from "axios"; -import Link from "next/link"; -import { useSearchParams } from "next/navigation"; -import React, { useEffect, useState } from "react"; -import { sendEmail } from "@/utils/sendMail"; - -export default function VerifyEmailPage() { - const searchParams = useSearchParams(); - const [token, setToken] = useState(""); - const [verified, setVerified] = useState(false); - const [error, setError] = useState(false); - - const verifyUserEmail = async () => { - try { - await axios.post("/api/users/verify-email", { token }); - setVerified(true); - } catch (error: unknown) { - setError(true); - console.log(getErrorMessage(error)); - } - }; - - useEffect(() => { - const urlToken = searchParams.get("token"); - setToken(urlToken || ""); - }, [searchParams]); - - useEffect(() => { - if (token.length > 0) { - verifyUserEmail(); - } - }, [token]); - - return ( -
-

Email Verification

- {verified ? ( -
-

- Your email has been successfully verified! -

-

You can now proceed to login.

- {/* */} -
- ) : ( -
-

- Error -

-

- There was an error verifying your email. Please try again later. -

-
- )} -
- ); -}