message-verify 1.0.1-beta.22 → 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.
@@ -69,15 +69,37 @@ const CreateMessageVerifyModal = ({ props }) => {
69
69
  setOtp(val);
70
70
  if (val.length === 6) {
71
71
  try {
72
- const res = await http({
73
- ...config,
74
- headers: {
75
- ...http.defaults.headers.common,
76
- 'sms-code': val,
77
- 'sms-code-key': verifyCodeKey,
78
- 'Content-Type': config.headers['Content-Type'],
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
+ // })
81
103
  console.log('resresresresres');
82
104
  console.log('res', res);
83
105
  if (!res) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "message-verify",
3
- "version": "1.0.1-beta.22",
3
+ "version": "1.0.1-beta.23",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "dependencies": {
@@ -85,15 +85,37 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
85
85
  setOtp(val);
86
86
  if (val.length === 6) {
87
87
  try {
88
- const res = await http({
89
- ...config,
90
- headers: {
91
- ...http.defaults.headers.common,
92
- 'sms-code': val,
93
- 'sms-code-key': verifyCodeKey,
94
- 'Content-Type': config.headers['Content-Type'],
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
+ // })
97
119
  console.log('resresresresres')
98
120
  console.log('res', res);
99
121
  if (!res) {