message-verify 0.0.52-beta.0 → 1.0.0-beta.0

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
@@ -1,16 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { createRoot } from 'react-dom/client';
3
3
  import { createMessageVerifyModal } from './index.js'; // 或 './index'
4
+ import { axios } from '@yqg/resource';
4
5
  const data = "{\"mobile\":\"188****4035\",\"verifyCodeKey\":\"3f025b33-988e-47c0-950d-6beb776d043f\",\"needValid\":true,\"step\":2,\"message\":\"需要填写验证码\"}";
5
6
  createRoot(document.getElementById('root')).render(_jsx("button", { onClick: () => createMessageVerifyModal({
6
7
  data,
7
8
  config: {},
8
9
  lang: 'en',
9
- http: Object.assign(() => Promise.resolve({}), {
10
- defaults: {
11
- headers: {
12
- common: {}
13
- }
14
- }
15
- }),
10
+ http: axios,
16
11
  }), children: "Show Modal" }));
@@ -57,9 +57,15 @@ const CreateMessageVerifyModal = ({ props }) => {
57
57
  }, children: [_jsx("div", { style: { fontSize: 14, color: '#666' }, children: t('alreadySend', lang, { phone: mobile }) }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 8, marginTop: 12 }, children: [_jsx(Input.OTP, { length: 6, value: otp, onChange: (val) => {
58
58
  setOtp(val);
59
59
  if (val.length === 6) {
60
- http.defaults.headers.common['sms-code'] = val;
61
- http.defaults.headers.common['sms-code-key'] = verifyCodeKey;
62
- http(config);
60
+ console.log('otp', val);
61
+ http({
62
+ ...config,
63
+ headers: {
64
+ ...http.defaults.headers.common,
65
+ 'sms-code': val,
66
+ 'sms-code-key': verifyCodeKey,
67
+ }
68
+ });
63
69
  setVisible(false);
64
70
  }
65
71
  } }), _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": "0.0.52-beta.0",
3
+ "version": "1.0.0-beta.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "dependencies": {
package/src/main.tsx CHANGED
@@ -1,5 +1,6 @@
1
1
  import { createRoot } from 'react-dom/client';
2
2
  import { createMessageVerifyModal } from './index.js'; // 或 './index'
3
+ import { axios } from '@yqg/resource';
3
4
 
4
5
  const data = "{\"mobile\":\"188****4035\",\"verifyCodeKey\":\"3f025b33-988e-47c0-950d-6beb776d043f\",\"needValid\":true,\"step\":2,\"message\":\"需要填写验证码\"}";
5
6
 
@@ -8,16 +9,7 @@ createRoot(document.getElementById('root')!).render(
8
9
  data,
9
10
  config: {},
10
11
  lang: 'en',
11
- http: Object.assign(
12
- () => Promise.resolve({}),
13
- {
14
- defaults: {
15
- headers: {
16
- common: {}
17
- }
18
- }
19
- }
20
- ),
12
+ http: axios,
21
13
  })}>
22
14
  Show Modal
23
15
  </button>);
@@ -87,9 +87,15 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
87
87
  onChange={(val) => {
88
88
  setOtp(val);
89
89
  if (val.length === 6) {
90
- http.defaults.headers.common['sms-code'] = val as string;
91
- http.defaults.headers.common['sms-code-key'] = verifyCodeKey as string;
92
- http(config);
90
+ console.log('otp', val);
91
+ http({
92
+ ...config,
93
+ headers: {
94
+ ...http.defaults.headers.common,
95
+ 'sms-code': val,
96
+ 'sms-code-key': verifyCodeKey,
97
+ }
98
+ });
93
99
  setVisible(false);
94
100
  }
95
101
  }} />