diff --git a/app/(auth)/auth/verify-otp-registration/page.tsx b/app/(auth)/auth/verify-otp-registration/page.tsx index d93a136..96020bc 100644 --- a/app/(auth)/auth/verify-otp-registration/page.tsx +++ b/app/(auth)/auth/verify-otp-registration/page.tsx @@ -1,4 +1,6 @@ import VerifyRegistrationOTPForm from "@/components/auth/verify-registration-otp-form"; +import { checkIdOrPhone } from "@/queries/authentication"; +import { tryCatch } from "@/utils/tryCatch"; import Image from "next/image"; import { redirect } from "next/navigation"; import React from "react"; @@ -16,7 +18,12 @@ export default async function VerifyRegistrationOTP({ "phone number from server page params (verify otp page)", phone_number, ); - + const [error, response] = await tryCatch(checkIdOrPhone({ phone_number })); + if (error) { + console.log("Error in checkIdOrPhone", error); + return redirect("/auth/signin"); + } + if (response.verified || !response.verified) redirect("/auth/signin"); return (