message-verify 1.0.1-beta.46 → 1.0.1-beta.47
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/modal/verify-modal.js +46 -22
- package/package.json +1 -1
- package/src/modal/verify-modal.tsx +46 -22
@@ -69,29 +69,53 @@ const CreateMessageVerifyModal = ({ props }) => {
|
|
69
69
|
}, children: [_jsx("div", { style: { fontSize: 14, color: '#666' }, children: t('alreadySend', lang, { phone: mobile }) }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 8, marginTop: 12 }, children: [_jsx(Input.OTP, { length: 6, value: otp, onChange: async (val) => {
|
70
70
|
setOtp(val);
|
71
71
|
if (val.length === 6) {
|
72
|
+
// try {
|
73
|
+
// const res = await Promise.race([
|
74
|
+
// new Promise((resolve, reject) => {
|
75
|
+
// setTimeout(() => {
|
76
|
+
// reject(new Error('Timeout'));
|
77
|
+
// }, 1000);
|
78
|
+
// }),
|
79
|
+
// new Promise((resolve, reject) => {
|
80
|
+
// setTimeout(() => {
|
81
|
+
// http({
|
82
|
+
// ...config,
|
83
|
+
// headers: {
|
84
|
+
// ...http.defaults.headers.common,
|
85
|
+
// 'sms-code': val,
|
86
|
+
// 'sms-code-key': verifyCodeKey,
|
87
|
+
// 'Content-Type': config.headers['Content-Type'],
|
88
|
+
// }
|
89
|
+
// }).then(res => {
|
90
|
+
// resolve(res);
|
91
|
+
// }).catch(err => {
|
92
|
+
// reject(err);
|
93
|
+
// })}, 6000);
|
94
|
+
// })
|
95
|
+
// ]) as any;
|
96
|
+
// if (res?.data?.status?.code === 0) {
|
97
|
+
// apiResolve(res);
|
98
|
+
// setVisible(false);
|
99
|
+
// } else {
|
100
|
+
// message.error('验证失败');
|
101
|
+
// setOtp('');
|
102
|
+
// }
|
103
|
+
// } catch (error) {
|
104
|
+
// console.warn('catch', error);
|
105
|
+
// message.error('验证失败');
|
106
|
+
// setOtp('');
|
107
|
+
// }
|
72
108
|
try {
|
73
|
-
const res = await
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
...http.defaults.headers.common,
|
84
|
-
'sms-code': val,
|
85
|
-
'sms-code-key': verifyCodeKey,
|
86
|
-
'Content-Type': config.headers['Content-Type'],
|
87
|
-
}
|
88
|
-
}).then(res => {
|
89
|
-
resolve(res);
|
90
|
-
}).catch(err => {
|
91
|
-
reject(err);
|
92
|
-
});
|
93
|
-
})
|
94
|
-
]);
|
109
|
+
const res = await http({
|
110
|
+
...config,
|
111
|
+
headers: {
|
112
|
+
...http.defaults.headers.common,
|
113
|
+
'sms-code': val,
|
114
|
+
'sms-code-key': verifyCodeKey,
|
115
|
+
'Content-Type': config.headers['Content-Type'],
|
116
|
+
}
|
117
|
+
});
|
118
|
+
console.log('res', res);
|
95
119
|
if (res?.data?.status?.code === 0) {
|
96
120
|
apiResolve(res);
|
97
121
|
setVisible(false);
|
package/package.json
CHANGED
@@ -85,29 +85,53 @@ const CreateMessageVerifyModal = ({ props }: { props: VerifyModalConfig }) => {
|
|
85
85
|
onChange={async (val) => {
|
86
86
|
setOtp(val);
|
87
87
|
if (val.length === 6) {
|
88
|
+
// try {
|
89
|
+
// const res = await Promise.race([
|
90
|
+
// new Promise((resolve, reject) => {
|
91
|
+
// setTimeout(() => {
|
92
|
+
// reject(new Error('Timeout'));
|
93
|
+
// }, 1000);
|
94
|
+
// }),
|
95
|
+
// new Promise((resolve, reject) => {
|
96
|
+
// setTimeout(() => {
|
97
|
+
// http({
|
98
|
+
// ...config,
|
99
|
+
// headers: {
|
100
|
+
// ...http.defaults.headers.common,
|
101
|
+
// 'sms-code': val,
|
102
|
+
// 'sms-code-key': verifyCodeKey,
|
103
|
+
// 'Content-Type': config.headers['Content-Type'],
|
104
|
+
// }
|
105
|
+
// }).then(res => {
|
106
|
+
// resolve(res);
|
107
|
+
// }).catch(err => {
|
108
|
+
// reject(err);
|
109
|
+
// })}, 6000);
|
110
|
+
// })
|
111
|
+
// ]) as any;
|
112
|
+
// if (res?.data?.status?.code === 0) {
|
113
|
+
// apiResolve(res);
|
114
|
+
// setVisible(false);
|
115
|
+
// } else {
|
116
|
+
// message.error('验证失败');
|
117
|
+
// setOtp('');
|
118
|
+
// }
|
119
|
+
// } catch (error) {
|
120
|
+
// console.warn('catch', error);
|
121
|
+
// message.error('验证失败');
|
122
|
+
// setOtp('');
|
123
|
+
// }
|
88
124
|
try {
|
89
|
-
const res = await
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
...http.defaults.headers.common,
|
100
|
-
'sms-code': val,
|
101
|
-
'sms-code-key': verifyCodeKey,
|
102
|
-
'Content-Type': config.headers['Content-Type'],
|
103
|
-
}
|
104
|
-
}).then(res => {
|
105
|
-
resolve(res);
|
106
|
-
}).catch(err => {
|
107
|
-
reject(err);
|
108
|
-
})
|
109
|
-
})
|
110
|
-
]) as any;
|
125
|
+
const res = await http({
|
126
|
+
...config,
|
127
|
+
headers: {
|
128
|
+
...http.defaults.headers.common,
|
129
|
+
'sms-code': val,
|
130
|
+
'sms-code-key': verifyCodeKey,
|
131
|
+
'Content-Type': config.headers['Content-Type'],
|
132
|
+
}
|
133
|
+
}) as any;
|
134
|
+
console.log('res', res);
|
111
135
|
if (res?.data?.status?.code === 0) {
|
112
136
|
apiResolve(res);
|
113
137
|
setVisible(false);
|