import Button from "@/utils/button"; import OTPInput from "./otpInput"; import { useEffect, useState, } from "react"; import {Props} from "@/constants/types" export default function VerifyCode({ onBack }: Props) { const [timer, setTimer] = useState(30); useEffect(() => { if (timer === 0) return; const interval = setInterval(() => { setTimer((prev) => prev - 1); }, 1000); return () => clearInterval(interval); }, [timer]); const handleResend = () => { if (timer > 0) return; // Call your resend OTP API here setTimer(30); }; return (

Two-factor authentication

Enter the 6-digit code from your authenticator app, or the
code we sent to{" "} d•••@kafm.io .

{timer > 0 && ( {timer}s )}
); }