message-verify 1.0.0-beta.7 → 1.0.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/locales/en.d.ts +1 -0
- package/dist/locales/en.js +1 -0
- package/dist/locales/id.d.ts +1 -0
- package/dist/locales/id.js +1 -0
- package/dist/locales/zh.d.ts +1 -0
- package/dist/locales/zh.js +1 -0
- package/dist/verify-modal.js +8 -3
- package/package.json +1 -1
- package/src/locales/en.ts +1 -0
- package/src/locales/id.ts +1 -0
- package/src/locales/zh.ts +1 -0
- package/src/verify-modal.tsx +7 -2
package/dist/locales/en.d.ts
CHANGED
package/dist/locales/en.js
CHANGED
@@ -4,6 +4,7 @@ export default {
|
|
4
4
|
verifyCode: 'Verification Code',
|
5
5
|
pleaseEnterAndSend: 'Please enter the image verification code first, then resend the code',
|
6
6
|
sendSuccess: 'Successfully sent',
|
7
|
+
sendFailed: 'Send failed',
|
7
8
|
reSend: 'Resend',
|
8
9
|
countDownSecound: '{countdown} seconds'
|
9
10
|
};
|
package/dist/locales/id.d.ts
CHANGED
package/dist/locales/id.js
CHANGED
@@ -4,6 +4,7 @@ export default {
|
|
4
4
|
verifyCode: 'Kode Verifikasi',
|
5
5
|
pleaseEnterAndSend: 'Harap masukkan kode verifikasi gambar terlebih dahulu, lalu kirim ulang kode',
|
6
6
|
sendSuccess: 'Berhasil dikirim',
|
7
|
+
sendFailed: 'Gagal mengirim',
|
7
8
|
reSend: 'Kirim Ulang',
|
8
9
|
countDownSecound: '{countdown} detik'
|
9
10
|
};
|
package/dist/locales/zh.d.ts
CHANGED
package/dist/locales/zh.js
CHANGED
package/dist/verify-modal.js
CHANGED
@@ -6,7 +6,7 @@ import t from './utils/i18n.js';
|
|
6
6
|
import { axios } from '@yqg/resource';
|
7
7
|
const CreateMessageVerifyModal = ({ props }) => {
|
8
8
|
const [visible, setVisible] = useState(true);
|
9
|
-
const [countdown, setCountdown] = useState(
|
9
|
+
const [countdown, setCountdown] = useState(2);
|
10
10
|
const [otp, setOtp] = useState('');
|
11
11
|
const [captchaImage, setCaptchaImage] = useState('');
|
12
12
|
const [captchCode, setCaptchCode] = useState('');
|
@@ -47,13 +47,18 @@ const CreateMessageVerifyModal = ({ props }) => {
|
|
47
47
|
};
|
48
48
|
}, [visible, countdown]);
|
49
49
|
const handleResend = async () => {
|
50
|
-
setCountdown(60);
|
51
50
|
const formData = new FormData();
|
52
51
|
formData.append('captchaKey', captchaKey);
|
53
52
|
formData.append('captcha', captchCode);
|
54
53
|
// 重新发送验证码
|
55
|
-
await axios.post(api, formData);
|
54
|
+
const res = await axios.post(api, formData);
|
55
|
+
const { code, detail } = res.data?.status || {};
|
56
|
+
if (code !== 0) {
|
57
|
+
message.error(detail || t('sendFailed', lang));
|
58
|
+
return;
|
59
|
+
}
|
56
60
|
message.success(t('sendSuccess', lang));
|
61
|
+
setCountdown(60);
|
57
62
|
};
|
58
63
|
return (_jsxs(Modal, { width: 420, visible: visible, onClose: () => {
|
59
64
|
setVisible(false);
|
package/package.json
CHANGED
package/src/locales/en.ts
CHANGED
@@ -4,6 +4,7 @@ export default {
|
|
4
4
|
verifyCode: 'Verification Code',
|
5
5
|
pleaseEnterAndSend: 'Please enter the image verification code first, then resend the code',
|
6
6
|
sendSuccess: 'Successfully sent',
|
7
|
+
sendFailed: 'Send failed',
|
7
8
|
reSend: 'Resend',
|
8
9
|
countDownSecound: '{countdown} seconds'
|
9
10
|
};
|
package/src/locales/id.ts
CHANGED
@@ -4,6 +4,7 @@ export default {
|
|
4
4
|
verifyCode: 'Kode Verifikasi',
|
5
5
|
pleaseEnterAndSend: 'Harap masukkan kode verifikasi gambar terlebih dahulu, lalu kirim ulang kode',
|
6
6
|
sendSuccess: 'Berhasil dikirim',
|
7
|
+
sendFailed: 'Gagal mengirim',
|
7
8
|
reSend: 'Kirim Ulang',
|
8
9
|
countDownSecound: '{countdown} detik'
|
9
10
|
};
|
package/src/locales/zh.ts
CHANGED
package/src/verify-modal.tsx
CHANGED
@@ -49,13 +49,18 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
|
|
49
49
|
}, [visible, countdown]);
|
50
50
|
|
51
51
|
const handleResend = async () => {
|
52
|
-
setCountdown(60);
|
53
52
|
const formData = new FormData();
|
54
53
|
formData.append('captchaKey', captchaKey);
|
55
54
|
formData.append('captcha', captchCode);
|
56
55
|
// 重新发送验证码
|
57
|
-
await axios.post(api, formData);
|
56
|
+
const res = await axios.post(api, formData);
|
57
|
+
const { code, detail } = res.data?.status || {};
|
58
|
+
if (code !== 0) {
|
59
|
+
message.error(detail || t('sendFailed', lang));
|
60
|
+
return;
|
61
|
+
}
|
58
62
|
message.success(t('sendSuccess', lang));
|
63
|
+
setCountdown(60);
|
59
64
|
}
|
60
65
|
|
61
66
|
return (
|