@wzyjs/hooks 0.0.18 → 0.0.21

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.
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const useEffectValue: (fn: any, deps?: never[]) => (import("react").Dispatch<import("react").SetStateAction<undefined>> | undefined)[];
@@ -7,5 +7,5 @@ interface UserOptions<P extends any[], R> extends Options<R, P> {
7
7
  interface IResult<R extends RequestRes, P extends any[]> extends Omit<Result<R, P>, 'data'> {
8
8
  data?: R['data'];
9
9
  }
10
- export declare const useRequestPro: <P extends any[], R extends RequestRes<any>>(reqPromise: Service<R, P>, userOptions?: UserOptions<P, R> | undefined) => IResult<R, P>;
10
+ export declare const useRequestPro: <P extends any[], R extends RequestRes<any>>(reqPromise?: Service<R, P> | undefined, userOptions?: UserOptions<P, R> | undefined) => IResult<R, P> | null;
11
11
  export {};
@@ -2,6 +2,9 @@ import { message } from 'antd';
2
2
  import { omit } from '@wzyjs/utils';
3
3
  import { useRequest } from 'ahooks';
4
4
  export const useRequestPro = (reqPromise, userOptions) => {
5
+ if (!reqPromise) {
6
+ return null;
7
+ }
5
8
  const { alertErrorMessage = true, alertSuccessMessage = false } = userOptions || {};
6
9
  const defaultOptions = {
7
10
  debounceWait: 300,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wzyjs/hooks",
3
- "version": "0.0.18",
3
+ "version": "0.0.21",
4
4
  "description": "description",
5
5
  "author": "wzy",
6
6
  "license": "ISC",
@@ -15,7 +15,7 @@
15
15
  ],
16
16
  "dependencies": {
17
17
  "@types/react": "^18.0.28",
18
- "@wzyjs/utils": "^0.0.18",
18
+ "@wzyjs/utils": "^0.0.21",
19
19
  "ahooks": "^3.7.3",
20
20
  "antd": "^5.1.0",
21
21
  "react-use": "^17.4.0"
@@ -34,5 +34,5 @@
34
34
  "type": "git",
35
35
  "url": "https://gitee.com/wang-zhenyu/work.git"
36
36
  },
37
- "gitHead": "7ebb80ef50a4df3d262a1da82d7967e628698b10"
37
+ "gitHead": "e9f0222770f1a8a3b3365e9fadd8f65a069a3ef5"
38
38
  }