message-verify 1.0.1-beta.23 → 1.0.1-beta.26
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/verify-modal.js +11 -9
- package/package.json +1 -1
- package/src/verify-modal.tsx +12 -10
package/dist/verify-modal.js
CHANGED
@@ -11,7 +11,7 @@ const CreateMessageVerifyModal = ({ props }) => {
|
|
11
11
|
const [captchaImage, setCaptchaImage] = useState('');
|
12
12
|
const [captchCode, setCaptchCode] = useState('');
|
13
13
|
const [captchaKey, setCaptchaKey] = useState('');
|
14
|
-
const { data, http, lang, api = '/admin/sms/send', config, apiResolve
|
14
|
+
const { data, http, lang, api = '/admin/sms/send', config, apiResolve } = props || {};
|
15
15
|
const dataObj = JSON.parse(data || '{}');
|
16
16
|
const { mobile, verifyCodeKey } = dataObj || {};
|
17
17
|
const getKey = async () => {
|
@@ -102,20 +102,22 @@ const CreateMessageVerifyModal = ({ props }) => {
|
|
102
102
|
// })
|
103
103
|
console.log('resresresresres');
|
104
104
|
console.log('res', res);
|
105
|
-
if (
|
106
|
-
|
107
|
-
|
105
|
+
if (res?.data?.status?.code === 0) {
|
106
|
+
apiResolve(res);
|
107
|
+
setVisible(false);
|
108
|
+
// apiReject();
|
108
109
|
}
|
109
110
|
else {
|
110
|
-
|
111
|
+
message.error('验证失败');
|
112
|
+
setOtp('');
|
111
113
|
}
|
112
|
-
setVisible(false);
|
113
114
|
}
|
114
115
|
catch (error) {
|
115
|
-
console.
|
116
|
+
console.warn('catch', error);
|
116
117
|
message.error('验证失败');
|
117
|
-
apiReject(error);
|
118
|
-
setVisible(false);
|
118
|
+
// apiReject(error);
|
119
|
+
// setVisible(false);
|
120
|
+
setOtp('');
|
119
121
|
}
|
120
122
|
}
|
121
123
|
} }), _jsx(Button, { disabled: countdown > 0 || !captchCode, onClick: handleResend, style: { padding: '8px' }, children: countdown > 0 ? t('countDownSecound', lang, { countdown }) : t('reSend', lang) })] }), countdown > 0 ? null :
|
package/package.json
CHANGED
package/src/verify-modal.tsx
CHANGED
@@ -12,7 +12,7 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
|
|
12
12
|
const [captchaImage, setCaptchaImage] = useState<string>('');
|
13
13
|
const [captchCode, setCaptchCode] = useState<string>('');
|
14
14
|
const [captchaKey, setCaptchaKey] = useState<string>('');
|
15
|
-
const { data, http, lang, api = '/admin/sms/send', config, apiResolve
|
15
|
+
const { data, http, lang, api = '/admin/sms/send', config, apiResolve } = props || {};
|
16
16
|
const dataObj = JSON.parse(data || '{}');
|
17
17
|
const { mobile, verifyCodeKey } = dataObj || {};
|
18
18
|
|
@@ -106,7 +106,7 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
|
|
106
106
|
reject(err);
|
107
107
|
})
|
108
108
|
})
|
109
|
-
])
|
109
|
+
]) as any;
|
110
110
|
// const res = await http({
|
111
111
|
// ...config,
|
112
112
|
// headers: {
|
@@ -118,18 +118,20 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
|
|
118
118
|
// })
|
119
119
|
console.log('resresresresres')
|
120
120
|
console.log('res', res);
|
121
|
-
if (
|
122
|
-
message.error('验证失败');
|
123
|
-
apiReject();
|
124
|
-
} else {
|
121
|
+
if (res?.data?.status?.code === 0) {
|
125
122
|
apiResolve(res);
|
123
|
+
setVisible(false);
|
124
|
+
// apiReject();
|
125
|
+
} else {
|
126
|
+
message.error('验证失败');
|
127
|
+
setOtp('');
|
126
128
|
}
|
127
|
-
setVisible(false);
|
128
129
|
} catch (error) {
|
129
|
-
console.
|
130
|
+
console.warn('catch', error);
|
130
131
|
message.error('验证失败');
|
131
|
-
apiReject(error);
|
132
|
-
setVisible(false);
|
132
|
+
// apiReject(error);
|
133
|
+
// setVisible(false);
|
134
|
+
setOtp('');
|
133
135
|
}
|
134
136
|
}
|
135
137
|
}} />
|