message-verify 1.0.1-beta.13 → 1.0.1-beta.14

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/main.js CHANGED
@@ -11,6 +11,12 @@ const config = {
11
11
  "forcedJSONParsing": true,
12
12
  "clarifyTimeoutError": false
13
13
  },
14
+ // "transformRequest": [
15
+ // null
16
+ // ],
17
+ // "transformResponse": [
18
+ // null
19
+ // ],
14
20
  "timeout": 0,
15
21
  "xsrfCookieName": "XSRF-TOKEN",
16
22
  "xsrfHeaderName": "X-XSRF-TOKEN",
@@ -19,9 +25,7 @@ const config = {
19
25
  "headers": {
20
26
  "Accept": "application/json, text/plain, */*",
21
27
  "X-Device-Fingerprint": "185fcce88c629725321adf29daa5e444",
22
- "Content-Type": "application/json",
23
- "sms-code": "121212",
24
- "sms-code-key": "212190c7-2f5e-4cc1-82ec-a242c2ab5425"
28
+ "Content-Type": "application/json"
25
29
  },
26
30
  "url": "/classification/admin/level/edit",
27
31
  "method": "post",
@@ -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', response } = props || {};
14
+ const { data, http, lang, api = '/admin/sms/send', config } = props || {};
15
15
  const dataObj = JSON.parse(data || '{}');
16
16
  const { mobile, verifyCodeKey } = dataObj || {};
17
17
  const getKey = async () => {
@@ -67,26 +67,27 @@ const CreateMessageVerifyModal = ({ props }) => {
67
67
  setOtp(val);
68
68
  if (val.length === 6) {
69
69
  try {
70
- const res = await axios({
71
- ...response?.config,
70
+ const res = await http({
71
+ ...config,
72
72
  headers: {
73
- ...axios.defaults.headers.common,
73
+ ...http.defaults.headers.common,
74
74
  'sms-code': val,
75
75
  'sms-code-key': verifyCodeKey,
76
- 'Content-Type': response?.config.headers['Content-Type'],
76
+ 'Content-Type': config.headers['Content-Type'],
77
77
  }
78
78
  });
79
- console.log('res', res);
80
- const { code, detail } = response?.data?.status || {};
79
+ console.log('组件打印res', res);
80
+ const { data: { status: { code, detail } } } = res || {};
81
81
  if (code !== 0) {
82
82
  const detailObj = JSON.parse(detail || '{}');
83
+ console.log('detailObj', detailObj);
83
84
  message.error(detailObj?.message || t('sendFailed', lang));
84
85
  return;
85
86
  }
86
87
  else {
87
88
  // message.success(t('verifySuccess', lang));
88
89
  setVisible(false);
89
- return Promise.resolve(response);
90
+ // return Promise.resolve(response);
90
91
  }
91
92
  }
92
93
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "message-verify",
3
- "version": "1.0.1-beta.13",
3
+ "version": "1.0.1-beta.14",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "dependencies": {
package/src/main.tsx CHANGED
@@ -13,6 +13,12 @@ const config = {
13
13
  "forcedJSONParsing": true,
14
14
  "clarifyTimeoutError": false
15
15
  },
16
+ // "transformRequest": [
17
+ // null
18
+ // ],
19
+ // "transformResponse": [
20
+ // null
21
+ // ],
16
22
  "timeout": 0,
17
23
  "xsrfCookieName": "XSRF-TOKEN",
18
24
  "xsrfHeaderName": "X-XSRF-TOKEN",
@@ -21,9 +27,7 @@ const config = {
21
27
  "headers": {
22
28
  "Accept": "application/json, text/plain, */*",
23
29
  "X-Device-Fingerprint": "185fcce88c629725321adf29daa5e444",
24
- "Content-Type": "application/json",
25
- "sms-code": "121212",
26
- "sms-code-key": "212190c7-2f5e-4cc1-82ec-a242c2ab5425"
30
+ "Content-Type": "application/json"
27
31
  },
28
32
  "url": "/classification/admin/level/edit",
29
33
  "method": "post",
@@ -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', response } = props || {};
15
+ const { data, http, lang, api='/admin/sms/send', config } = props || {};
16
16
  const dataObj = JSON.parse(data || '{}');
17
17
  const { mobile, verifyCodeKey } = dataObj || {};
18
18
 
@@ -82,25 +82,26 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
82
82
  setOtp(val);
83
83
  if (val.length === 6) {
84
84
  try {
85
- const res = await axios({
86
- ...response?.config,
85
+ const res = await http({
86
+ ...config,
87
87
  headers: {
88
- ...axios.defaults.headers.common,
88
+ ...http.defaults.headers.common,
89
89
  'sms-code': val,
90
90
  'sms-code-key': verifyCodeKey,
91
- 'Content-Type': response?.config.headers['Content-Type'],
91
+ 'Content-Type': config.headers['Content-Type'],
92
92
  }
93
93
  });
94
- console.log('res', res);
95
- const { code, detail } = response?.data?.status || {};
94
+ console.log('组件打印res', res);
95
+ const {data: {status: {code, detail}}} = res || {} as any;
96
96
  if (code !== 0) {
97
97
  const detailObj = JSON.parse(detail || '{}');
98
+ console.log('detailObj', detailObj);
98
99
  message.error(detailObj?.message || t('sendFailed', lang));
99
100
  return;
100
101
  } else {
101
102
  // message.success(t('verifySuccess', lang));
102
103
  setVisible(false);
103
- return Promise.resolve(response);
104
+ // return Promise.resolve(response);
104
105
  }
105
106
  } catch (error: any) {
106
107
  message.error(error?.message || t('sendFailed', lang));