message-verify 1.0.1-beta.41 → 1.0.1-beta.43

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/index.js CHANGED
@@ -55,7 +55,7 @@ const destroyModal = () => {
55
55
  }
56
56
  };
57
57
  export const VerifyHandler = (modalProps) => {
58
- const { data, config, http, verifyPromise } = modalProps || {};
58
+ const { data, config, http, verifyPromise, sendApi } = modalProps || {};
59
59
  const toEmpty = () => {
60
60
  verifyPromise.current = null;
61
61
  };
@@ -68,6 +68,7 @@ export const VerifyHandler = (modalProps) => {
68
68
  apiResolve: resolve,
69
69
  apiReject: reject,
70
70
  apiPromiseToEmpty: toEmpty,
71
+ sendApi
71
72
  });
72
73
  }).finally(toEmpty);
73
74
  }
@@ -18,7 +18,7 @@ export type VerifyModalConfig = {
18
18
  };
19
19
  };
20
20
  };
21
- api?: string;
21
+ sendApi?: string;
22
22
  apiReject?: any;
23
23
  apiResolve?: any;
24
24
  apiPromiseToEmpty?: () => void;
@@ -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, apiPromiseToEmpty } = props || {};
14
+ const { data, http, lang, sendApi = '/admin/sms/send', config, apiResolve, apiPromiseToEmpty } = props || {};
15
15
  const dataObj = JSON.parse(data || '{}');
16
16
  const { mobile, verifyCodeKey } = dataObj || {};
17
17
  const getKey = async () => {
@@ -51,7 +51,7 @@ const CreateMessageVerifyModal = ({ props }) => {
51
51
  formData.append('captchaKey', captchaKey);
52
52
  formData.append('captcha', captchCode);
53
53
  // 重新发送验证码
54
- const res = await axios.post(api, formData);
54
+ const res = await axios.post(sendApi, formData);
55
55
  const { code, detail } = res.data?.status || {};
56
56
  if (code !== 0) {
57
57
  message.error(detail || t('sendFailed', lang));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "message-verify",
3
- "version": "1.0.1-beta.41",
3
+ "version": "1.0.1-beta.43",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "dependencies": {
package/src/index.tsx CHANGED
@@ -72,7 +72,7 @@ const destroyModal = () => {
72
72
  }
73
73
 
74
74
  export const VerifyHandler = (modalProps: VerifyModalConfig): Promise<any> => {
75
- const {data, config, http, verifyPromise} = modalProps || {};
75
+ const {data, config, http, verifyPromise, sendApi} = modalProps || {};
76
76
  const toEmpty = () => {
77
77
  verifyPromise.current = null;
78
78
  };
@@ -85,6 +85,7 @@ export const VerifyHandler = (modalProps: VerifyModalConfig): Promise<any> => {
85
85
  apiResolve: resolve,
86
86
  apiReject: reject,
87
87
  apiPromiseToEmpty: toEmpty,
88
+ sendApi
88
89
  } as any);
89
90
  }).finally(toEmpty);
90
91
  }
package/src/utils/type.ts CHANGED
@@ -19,7 +19,7 @@ export type VerifyModalConfig = {
19
19
  }
20
20
  }
21
21
  };
22
- api?: string;
22
+ sendApi?: string;
23
23
  apiReject?: any;
24
24
  apiResolve?: any;
25
25
  apiPromiseToEmpty?: () => void;
@@ -12,7 +12,7 @@ const CreateMessageVerifyModal = ({ props }: { props: VerifyModalConfig }) => {
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, apiPromiseToEmpty } = props || {};
15
+ const { data, http, lang, sendApi = '/admin/sms/send', config, apiResolve, apiPromiseToEmpty } = props || {};
16
16
  const dataObj = JSON.parse(data || '{}');
17
17
  const { mobile, verifyCodeKey } = dataObj || {};
18
18
 
@@ -54,7 +54,7 @@ const CreateMessageVerifyModal = ({ props }: { props: VerifyModalConfig }) => {
54
54
  formData.append('captchaKey', captchaKey);
55
55
  formData.append('captcha', captchCode);
56
56
  // 重新发送验证码
57
- const res = await axios.post(api, formData);
57
+ const res = await axios.post(sendApi, formData);
58
58
  const { code, detail } = res.data?.status || {};
59
59
  if (code !== 0) {
60
60
  message.error(detail || t('sendFailed', lang));