message-verify 1.0.1-beta.24 → 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.
@@ -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, apiReject } = props || {};
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 (!res) {
106
- message.error('验证失败');
105
+ if (res?.data?.status?.code === 0) {
106
+ apiResolve(res);
107
+ setVisible(false);
107
108
  // apiReject();
108
109
  }
109
110
  else {
110
- apiResolve(res);
111
+ message.error('验证失败');
112
+ setOtp('');
111
113
  }
112
- setVisible(false);
113
114
  }
114
115
  catch (error) {
115
116
  console.warn('catch', error);
116
117
  message.error('验证失败');
117
118
  // apiReject(error);
118
- setVisible(false);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "message-verify",
3
- "version": "1.0.1-beta.24",
3
+ "version": "1.0.1-beta.26",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "dependencies": {
@@ -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, apiReject } = props || {};
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 (!res) {
122
- message.error('验证失败');
121
+ if (res?.data?.status?.code === 0) {
122
+ apiResolve(res);
123
+ setVisible(false);
123
124
  // apiReject();
124
125
  } else {
125
- apiResolve(res);
126
+ message.error('验证失败');
127
+ setOtp('');
126
128
  }
127
- setVisible(false);
128
129
  } catch (error) {
129
130
  console.warn('catch', error);
130
131
  message.error('验证失败');
131
132
  // apiReject(error);
132
- setVisible(false);
133
+ // setVisible(false);
134
+ setOtp('');
133
135
  }
134
136
  }
135
137
  }} />