diff --git a/src/components/Login/OtpPage.tsx b/src/components/Login/OtpPage.tsx index f7216020..88903697 100644 --- a/src/components/Login/OtpPage.tsx +++ b/src/components/Login/OtpPage.tsx @@ -19,6 +19,8 @@ import { reportError } from '~/reporting'; import { AuthApiService } from '~/api/auth-api.service'; import { CereWhiteLogo } from '~/components'; +const TIME_LEFT = 60; // seconds before next otp request + interface OtpProps { email?: string; onRequestLogin: (idToken: string) => void | Promise; @@ -33,7 +35,7 @@ const validationSchema = yup export const OtpPage = ({ email, onRequestLogin }: OtpProps) => { const location = useLocation(); const navigate = useNavigate(); - const [timeLeft, setTimeLeft] = useState(0); + const [timeLeft, setTimeLeft] = useState(TIME_LEFT); const { isGame } = useTheme(); const { @@ -71,7 +73,7 @@ export const OtpPage = ({ email, onRequestLogin }: OtpProps) => { }; const handleResend = async () => { - setTimeLeft(60); + setTimeLeft(TIME_LEFT); await AuthApiService.sendOtp(email!); };