LFFE-30 Merge branch 'feature/LFFE-30_implemention_auto_submit' into 'develop'
This commit is contained in:
@@ -12,6 +12,7 @@ import {useTranslations} from "next-intl";
|
|||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
import SvgLogin from "@/core/components/svgs/SvgLogin";
|
import SvgLogin from "@/core/components/svgs/SvgLogin";
|
||||||
import useRequest from "@/lib/app/hooks/useRequest";
|
import useRequest from "@/lib/app/hooks/useRequest";
|
||||||
|
import AutoSubmit from "@/core/components/AutoSubmit";
|
||||||
|
|
||||||
const SendTokenComponent = ({
|
const SendTokenComponent = ({
|
||||||
PhoneNumber,
|
PhoneNumber,
|
||||||
@@ -111,6 +112,7 @@ const SendTokenComponent = ({
|
|||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
<AutoSubmit/>
|
||||||
<Grid container>
|
<Grid container>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import ResendToken from "@/core/components/ResendToken";
|
|||||||
import useUser from "@/lib/app/hooks/useUser";
|
import useUser from "@/lib/app/hooks/useUser";
|
||||||
import SvgRegister from "@/core/components/svgs/SvgRegister";
|
import SvgRegister from "@/core/components/svgs/SvgRegister";
|
||||||
import useRequest from "@/lib/app/hooks/useRequest";
|
import useRequest from "@/lib/app/hooks/useRequest";
|
||||||
|
import AutoSubmit from "@/core/components/AutoSubmit";
|
||||||
|
|
||||||
const UserRegisterComponent = ({
|
const UserRegisterComponent = ({
|
||||||
PhoneNumber,
|
PhoneNumber,
|
||||||
@@ -109,7 +110,7 @@ const UserRegisterComponent = ({
|
|||||||
placeholder={t(
|
placeholder={t(
|
||||||
"LoginPage.text_field_enter_your_verification_code"
|
"LoginPage.text_field_enter_your_verification_code"
|
||||||
)}
|
)}
|
||||||
type={"text"}
|
type={"number"}
|
||||||
error={
|
error={
|
||||||
!!(props.touched.verification_code && props.errors.verification_code)
|
!!(props.touched.verification_code && props.errors.verification_code)
|
||||||
}
|
}
|
||||||
@@ -119,7 +120,9 @@ const UserRegisterComponent = ({
|
|||||||
? props.errors.verification_code
|
? props.errors.verification_code
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
|
onChange={(e) => e.target.value.length <= 6 ? props.setFieldValue("verification_code", e.target.value) : ""}
|
||||||
/>
|
/>
|
||||||
|
<AutoSubmit/>
|
||||||
<ResendToken
|
<ResendToken
|
||||||
initialTimerValue={initialTimerValue}
|
initialTimerValue={initialTimerValue}
|
||||||
timer={timer}
|
timer={timer}
|
||||||
|
|||||||
13
src/core/components/AutoSubmit.jsx
Normal file
13
src/core/components/AutoSubmit.jsx
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import {useFormikContext} from "formik";
|
||||||
|
import {useEffect} from "react";
|
||||||
|
|
||||||
|
const AutoSubmit = () => {
|
||||||
|
const {values, submitForm} = useFormikContext()
|
||||||
|
useEffect(() => {
|
||||||
|
if (values.verification_code.length === 6) {
|
||||||
|
submitForm();
|
||||||
|
}
|
||||||
|
}, [values, submitForm]);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AutoSubmit;
|
||||||
@@ -33,8 +33,6 @@ const GlobalHead = () => {
|
|||||||
sizes="180x180"
|
sizes="180x180"
|
||||||
href="/icons/maskable_icon_x192.png"
|
href="/icons/maskable_icon_x192.png"
|
||||||
/>
|
/>
|
||||||
<meta name="google" content="notranslate"/>
|
|
||||||
<meta name="robots" content="noindex"/>
|
|
||||||
<meta
|
<meta
|
||||||
name="viewport"
|
name="viewport"
|
||||||
content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no, user-scalable=no, viewport-fit=cover"
|
content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no, user-scalable=no, viewport-fit=cover"
|
||||||
|
|||||||
Reference in New Issue
Block a user