message-verify 1.0.1-beta.68 → 1.0.1-beta.69

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.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { VerifyModalConfig, LoginModalConfig } from './utils/type.js';
2
2
  export declare const initFingerprint: () => Promise<string>;
3
3
  export declare const createReLoginModal: (modalProps: LoginModalConfig) => void;
4
- export declare const getResponse: (response: any) => any;
5
- export declare const VerifyHandler: ({ data, config, http, verifyPromise, sendApi }: VerifyModalConfig) => Promise<any>;
4
+ export declare const VerifyHandler: {
5
+ ({ data, config, http, verifyPromise, sendApi }: VerifyModalConfig): Promise<any>;
6
+ getResponse(response: any): any;
7
+ };
package/dist/index.js CHANGED
@@ -55,16 +55,7 @@ export const createReLoginModal = (modalProps) => {
55
55
  const reLoginModalId = 'relogin-modal-container';
56
56
  creatModal(modalProps, reLoginModalId, ReLoginModal);
57
57
  };
58
- let fetchUrl = '';
59
- export const getResponse = (response) => {
60
- // if (fetchUrl === response.config.url) {
61
- console.log('VerifyHandler getResponse =>', response, fetchUrl);
62
- eventEmitter.emit('response', response?.data?.status?.code ?? -1);
63
- return response;
64
- // }
65
- };
66
58
  export const VerifyHandler = ({ data, config, http, verifyPromise, sendApi }) => {
67
- fetchUrl = config?.url || '';
68
59
  const toEmpty = () => {
69
60
  verifyPromise.current = null;
70
61
  };
@@ -83,3 +74,8 @@ export const VerifyHandler = ({ data, config, http, verifyPromise, sendApi }) =>
83
74
  }
84
75
  return verifyPromise.current;
85
76
  };
77
+ // 获取当前触发接口response
78
+ VerifyHandler.getResponse = (response) => {
79
+ eventEmitter.emit('response', response?.data?.status?.code ?? -1);
80
+ return response;
81
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "message-verify",
3
- "version": "1.0.1-beta.68",
3
+ "version": "1.0.1-beta.69",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "dependencies": {
package/src/index.tsx CHANGED
@@ -65,17 +65,7 @@ export const createReLoginModal = (modalProps: LoginModalConfig) => {
65
65
  creatModal(modalProps, reLoginModalId, ReLoginModal);
66
66
  }
67
67
 
68
- let fetchUrl: string = '';
69
- export const getResponse = (response: any) => {
70
- // if (fetchUrl === response.config.url) {
71
- console.log('VerifyHandler getResponse =>', response, fetchUrl);
72
- eventEmitter.emit('response', response?.data?.status?.code ?? -1);
73
- return response;
74
- // }
75
- }
76
-
77
68
  export const VerifyHandler = ({data, config, http, verifyPromise, sendApi}: VerifyModalConfig): Promise<any> => {
78
- fetchUrl = config?.url as string || '';
79
69
  const toEmpty = () => {
80
70
  verifyPromise.current = null;
81
71
  };
@@ -93,4 +83,10 @@ export const VerifyHandler = ({data, config, http, verifyPromise, sendApi}: Veri
93
83
  }).finally(toEmpty);
94
84
  }
95
85
  return verifyPromise.current;
96
- };
86
+ };
87
+
88
+ // 获取当前触发接口response
89
+ VerifyHandler.getResponse = (response: any) => {
90
+ eventEmitter.emit('response', response?.data?.status?.code ?? -1);
91
+ return response;
92
+ };