message-verify 1.0.1-beta.21 → 1.0.1-beta.23
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 +33 -9
- package/package.json +1 -1
- package/src/verify-modal.tsx +33 -9
package/dist/verify-modal.js
CHANGED
@@ -69,15 +69,38 @@ const CreateMessageVerifyModal = ({ props }) => {
|
|
69
69
|
setOtp(val);
|
70
70
|
if (val.length === 6) {
|
71
71
|
try {
|
72
|
-
const res = await
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
72
|
+
const res = await Promise.race([
|
73
|
+
new Promise((resolve, reject) => {
|
74
|
+
setTimeout(() => {
|
75
|
+
reject(new Error('Timeout'));
|
76
|
+
}, 1000);
|
77
|
+
}),
|
78
|
+
new Promise((resolve, reject) => {
|
79
|
+
http({
|
80
|
+
...config,
|
81
|
+
headers: {
|
82
|
+
...http.defaults.headers.common,
|
83
|
+
'sms-code': val,
|
84
|
+
'sms-code-key': verifyCodeKey,
|
85
|
+
'Content-Type': config.headers['Content-Type'],
|
86
|
+
}
|
87
|
+
}).then(res => {
|
88
|
+
resolve(res);
|
89
|
+
}).catch(err => {
|
90
|
+
reject(err);
|
91
|
+
});
|
92
|
+
})
|
93
|
+
]);
|
94
|
+
// const res = await http({
|
95
|
+
// ...config,
|
96
|
+
// headers: {
|
97
|
+
// ...http.defaults.headers.common,
|
98
|
+
// 'sms-code': val,
|
99
|
+
// 'sms-code-key': verifyCodeKey,
|
100
|
+
// 'Content-Type': config.headers['Content-Type'],
|
101
|
+
// }
|
102
|
+
// })
|
103
|
+
console.log('resresresresres');
|
81
104
|
console.log('res', res);
|
82
105
|
if (!res) {
|
83
106
|
message.error('验证失败');
|
@@ -89,6 +112,7 @@ const CreateMessageVerifyModal = ({ props }) => {
|
|
89
112
|
setVisible(false);
|
90
113
|
}
|
91
114
|
catch (error) {
|
115
|
+
console.log('catch');
|
92
116
|
message.error('验证失败');
|
93
117
|
apiReject(error);
|
94
118
|
setVisible(false);
|
package/package.json
CHANGED
package/src/verify-modal.tsx
CHANGED
@@ -85,15 +85,38 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
|
|
85
85
|
setOtp(val);
|
86
86
|
if (val.length === 6) {
|
87
87
|
try {
|
88
|
-
const res = await
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
88
|
+
const res = await Promise.race([
|
89
|
+
new Promise((resolve, reject) => {
|
90
|
+
setTimeout(() => {
|
91
|
+
reject(new Error('Timeout'));
|
92
|
+
}, 1000);
|
93
|
+
}),
|
94
|
+
new Promise((resolve, reject) => {
|
95
|
+
http({
|
96
|
+
...config,
|
97
|
+
headers: {
|
98
|
+
...http.defaults.headers.common,
|
99
|
+
'sms-code': val,
|
100
|
+
'sms-code-key': verifyCodeKey,
|
101
|
+
'Content-Type': config.headers['Content-Type'],
|
102
|
+
}
|
103
|
+
}).then(res => {
|
104
|
+
resolve(res);
|
105
|
+
}).catch(err => {
|
106
|
+
reject(err);
|
107
|
+
})
|
108
|
+
})
|
109
|
+
])
|
110
|
+
// const res = await http({
|
111
|
+
// ...config,
|
112
|
+
// headers: {
|
113
|
+
// ...http.defaults.headers.common,
|
114
|
+
// 'sms-code': val,
|
115
|
+
// 'sms-code-key': verifyCodeKey,
|
116
|
+
// 'Content-Type': config.headers['Content-Type'],
|
117
|
+
// }
|
118
|
+
// })
|
119
|
+
console.log('resresresresres')
|
97
120
|
console.log('res', res);
|
98
121
|
if (!res) {
|
99
122
|
message.error('验证失败');
|
@@ -103,6 +126,7 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
|
|
103
126
|
}
|
104
127
|
setVisible(false);
|
105
128
|
} catch (error) {
|
129
|
+
console.log('catch');
|
106
130
|
message.error('验证失败');
|
107
131
|
apiReject(error);
|
108
132
|
setVisible(false);
|