"use client"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { VerifyRegistrationOTP } from "@/queries/authentication"; import { Loader2 } from "lucide-react"; import Link from "next/link"; import { redirect, useSearchParams } from "next/navigation"; import { useActionState } from "react"; export default function VerifyRegistrationOTPForm({ phone_number, }: { phone_number: string }) { console.log("verification in OTP form", phone_number); const searchParams = useSearchParams(); const mobile = searchParams.get("phone_number"); if (!mobile) redirect("/auth/login"); const [state, formAction, isPending] = useActionState(VerifyRegistrationOTP, { message: "", status: "", }); return (

Please enter the OTP sent to your mobile number [{phone_number}] to verify and complete your registration

{state?.status === "error" && (

{state.message}

)} {state.status === "verify_error" && (

{state.message}

)}
Go back to{" "} login
); }