message-verify 1.0.1-beta.45 → 1.0.1-beta.46
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 +22 -23
- package/package.json +1 -1
- package/src/modal/verify-modal.tsx +8 -9
@@ -70,29 +70,28 @@ const CreateMessageVerifyModal = ({ props }) => {
|
|
70
70
|
setOtp(val);
|
71
71
|
if (val.length === 6) {
|
72
72
|
try {
|
73
|
-
const res =
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
}
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
})
|
94
|
-
|
95
|
-
// ]) as any;
|
73
|
+
const res = await Promise.race([
|
74
|
+
new Promise((resolve, reject) => {
|
75
|
+
setTimeout(() => {
|
76
|
+
reject(new Error('Timeout'));
|
77
|
+
}, 8000);
|
78
|
+
}),
|
79
|
+
new Promise((resolve, reject) => {
|
80
|
+
http({
|
81
|
+
...config,
|
82
|
+
headers: {
|
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
|
+
]);
|
96
95
|
if (res?.data?.status?.code === 0) {
|
97
96
|
apiResolve(res);
|
98
97
|
setVisible(false);
|
package/package.json
CHANGED
@@ -86,13 +86,12 @@ const CreateMessageVerifyModal = ({ props }: { props: VerifyModalConfig }) => {
|
|
86
86
|
setOtp(val);
|
87
87
|
if (val.length === 6) {
|
88
88
|
try {
|
89
|
-
const res =
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
// }),
|
89
|
+
const res = await Promise.race([
|
90
|
+
new Promise((resolve, reject) => {
|
91
|
+
setTimeout(() => {
|
92
|
+
reject(new Error('Timeout'));
|
93
|
+
}, 8000);
|
94
|
+
}),
|
96
95
|
new Promise((resolve, reject) => {
|
97
96
|
http({
|
98
97
|
...config,
|
@@ -107,8 +106,8 @@ const CreateMessageVerifyModal = ({ props }: { props: VerifyModalConfig }) => {
|
|
107
106
|
}).catch(err => {
|
108
107
|
reject(err);
|
109
108
|
})
|
110
|
-
})
|
111
|
-
|
109
|
+
})
|
110
|
+
]) as any;
|
112
111
|
if (res?.data?.status?.code === 0) {
|
113
112
|
apiResolve(res);
|
114
113
|
setVisible(false);
|