diff --git a/.gitignore b/.gitignore
index 4d29575..f21726c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,7 @@
.env.development.local
.env.test.local
.env.production.local
+.env
npm-debug.log*
yarn-debug.log*
diff --git a/src/http/types.ts b/src/http/types.ts
index 2f2604f..4045efc 100644
--- a/src/http/types.ts
+++ b/src/http/types.ts
@@ -16,7 +16,7 @@ export namespace HttpRequestPs {
export interface SendEmail {
email: string,
- type: 1 | 2 | 3 //1.register 2.withdraw 3.resetPwd
+ type: 1 | 2 | 3 | 5 //1.register 2.withdraw 3.resetPwd 5.transfer
}
export interface Login {
diff --git a/src/pages/forget/index.tsx b/src/pages/forget/index.tsx
index d5b67d4..37c8b54 100644
--- a/src/pages/forget/index.tsx
+++ b/src/pages/forget/index.tsx
@@ -54,7 +54,7 @@ const ForGet = () => {
+
diff --git a/src/pages/transfer/index.tsx b/src/pages/transfer/index.tsx
index a751334..dbba12e 100644
--- a/src/pages/transfer/index.tsx
+++ b/src/pages/transfer/index.tsx
@@ -1,10 +1,11 @@
import { Button, Form, Input, Select, notification } from 'antd'
import '../../styles/home.scss'
-import { useState } from 'react'
+import { useRef, useState } from 'react'
import { observer } from 'mobx-react'
import store from '../../store'
-import { http_transfer } from '../../http/api'
+import { http_send_email, http_transfer } from '../../http/api'
import { useTranslation } from 'react-i18next'
+import CountdownTimer, { CountdownTimerRef } from '../../components/CountdownTimer'
const Transfer = () => {
@@ -18,11 +19,37 @@ const Transfer = () => {
]
const [type, setType] = useState(-1)
+ const countdownRef = useRef(null)
const onSelect = (_type: any) => {
setType(_type)
}
+
+ const getVerifyCode = async () => {
+ try {
+ if (countdownRef.current?.isActive) return
+ countdownRef.current?.handleStart()
+ const res: any = await http_send_email({
+ email: userInfo.email,
+ type: 5
+ })
+ if (res.code === 0) {
+ notification.success({
+ message: t('Verification code sent successfully')
+ })
+ } else {
+ notification.error({
+ message: t('Failed to send verification code')
+ })
+ countdownRef.current?.handleStop()
+ }
+
+ } catch (error) {
+ countdownRef.current?.handleStop()
+ }
+ }
+
const onFinish = async (values: any) => {
const res: any = await http_transfer({
...values,
@@ -102,6 +129,19 @@ const Transfer = () => {
+ {
+ type === 2 && (
+ {t('Verification Code')}} name="code" rules={[{ required: true, message: t('Verification Code') }]}>
+
+
+
+
+
+ )
+ }
+