feat: implement checkTempIdOrPhone function and update OTP verification logic
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 1m29s

This commit is contained in:
2025-04-18 13:50:58 +05:00
parent 4127035471
commit f3f5800df6
3 changed files with 29 additions and 4 deletions

View File

@ -1,5 +1,6 @@
import VerifyRegistrationOTPForm from "@/components/auth/verify-registration-otp-form";
import { checkIdOrPhone } from "@/queries/authentication";
import ClientErrorMessage from "@/components/client-error-message";
import { checkIdOrPhone, checkTempIdOrPhone } from "@/queries/authentication";
import { tryCatch } from "@/utils/tryCatch";
import Image from "next/image";
import { redirect } from "next/navigation";
@ -18,12 +19,14 @@ export default async function VerifyRegistrationOTP({
"phone number from server page params (verify otp page)",
phone_number,
);
const [error, response] = await tryCatch(checkIdOrPhone({ phone_number }));
const [error, response] = await tryCatch(
checkTempIdOrPhone({ phone_number }),
);
if (error) {
console.log("Error in checkIdOrPhone", error);
return redirect("/auth/signin");
return <ClientErrorMessage message={error.message} />;
}
if (response.verified) redirect("/auth/signin");
if (response.otp_verified) redirect("/auth/signin");
return (
<div className="bg-gray-100 dark:bg-black w-full h-screen flex items-center justify-center font-sans">
<div className="flex flex-col items-center justify-center w-full h-full ">