set otp code
This commit is contained in:
@@ -28,6 +28,7 @@ function StepEnterNumber(_props: StepEnterNumberProps = {}) {
|
||||
const { t } = useTranslation('auth')
|
||||
const { name } = useParams()
|
||||
const [step, setStep] = useState(AUTH_STEP.ENTER_NUMBER)
|
||||
const [code, setCode] = useState('')
|
||||
|
||||
const { mutate: mutateOtpRequest, isPending } = useOtpRequest()
|
||||
|
||||
@@ -44,7 +45,9 @@ function StepEnterNumber(_props: StepEnterNumberProps = {}) {
|
||||
if (name) {
|
||||
values.slug = name as string
|
||||
mutateOtpRequest(values, {
|
||||
onSuccess: () => {
|
||||
onSuccess: (data) => {
|
||||
setCode(data?.data?.code)
|
||||
|
||||
toast(t('otp_sent'), 'success')
|
||||
setStep(AUTH_STEP.ENTER_OTP)
|
||||
},
|
||||
@@ -101,7 +104,7 @@ function StepEnterNumber(_props: StepEnterNumberProps = {}) {
|
||||
/>
|
||||
)}
|
||||
{step === AUTH_STEP.ENTER_OTP && (
|
||||
<StepOtp phone={formik.values.phone} slug={formik.values.slug} />
|
||||
<StepOtp phone={formik.values.phone} slug={formik.values.slug} code={code} />
|
||||
)}
|
||||
</div>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user