import { useVisa } from '../providers/VisaProvider'
import { VerifyOtp } from '../components/VerifyOtp'

export function VerifySignIn() {
  const { signIn, emailToVerify } = useVisa()

  const handleResend = async () => {
    if (!emailToVerify) return { success: false }
    return signIn(emailToVerify, '/signin/verify')
  }

  return (
    <VerifyOtp
      type="email"
      redirectTo="/"
      onResend={handleResend}
    />
  )
}
