diff --git a/src/pages/auth/components/LoginStep1.tsx b/src/pages/auth/components/LoginStep1.tsx
index 04a6661..1904586 100644
--- a/src/pages/auth/components/LoginStep1.tsx
+++ b/src/pages/auth/components/LoginStep1.tsx
@@ -39,7 +39,7 @@ const LoginStep1: FC = () => {
})
return (
-
+
)
}
diff --git a/src/pages/auth/components/LoginStep2.tsx b/src/pages/auth/components/LoginStep2.tsx
index 57f3005..2719679 100644
--- a/src/pages/auth/components/LoginStep2.tsx
+++ b/src/pages/auth/components/LoginStep2.tsx
@@ -1,4 +1,4 @@
-import { type FC, useEffect } from 'react'
+import { type FC, useEffect, useRef } from 'react'
import { type OtpVerifyType } from '../types/AuthTypes'
import { useFormik } from 'formik'
import * as Yup from 'yup'
@@ -20,6 +20,7 @@ const LoginStep2: FC = () => {
const { value, reset } = useCountDown(2, true)
const otpVerify = useOtpVerify()
const loginWithOtp = useLoginWithOtp()
+ const firstOtpInputRef = useRef
(null)
const formik = useFormik({
initialValues: {
@@ -51,6 +52,14 @@ const LoginStep2: FC = () => {
},
})
+ useEffect(() => {
+ const frameId = requestAnimationFrame(() => {
+ firstOtpInputRef.current?.focus()
+ })
+
+ return () => cancelAnimationFrame(frameId)
+ }, [])
+
useEffect(() => {
// بررسی پشتیبانی از Web OTP API
if (!("OTPCredential" in window)) return;
@@ -96,7 +105,7 @@ const LoginStep2: FC = () => {
return (
- */}
-
+
)
}