@vtj/utils 0.7.25 → 0.7.27

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vtj/utils",
3
3
  "private": false,
4
- "version": "0.7.25",
4
+ "version": "0.7.27",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "vue-tsc && vite build && npm run build:umd",
@@ -11,12 +11,12 @@
11
11
  "coverage": "vitest run --coverage"
12
12
  },
13
13
  "dependencies": {
14
- "@vtj/base": "^0.7.6"
14
+ "@vtj/base": "^0.7.7"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@types/js-cookie": "~3.0.6",
18
- "@vtj/cli": "^0.7.17",
19
- "axios": "~1.6.4",
18
+ "@vtj/cli": "^0.7.18",
19
+ "axios": "~1.6.8",
20
20
  "fetch-jsonp": "~1.3.0",
21
21
  "js-cookie": "~3.0.5",
22
22
  "load-script": "~2.0.0"
@@ -35,7 +35,7 @@
35
35
  "dist",
36
36
  "types"
37
37
  ],
38
- "gitHead": "5e7b3352a98a88cc14672d3be9ce64a6f3b60d73",
38
+ "gitHead": "0927bed3c5055697dae99cfdb67f6a6915420bfe",
39
39
  "publishConfig": {
40
40
  "access": "public"
41
41
  }
@@ -1,3 +1,4 @@
1
+ import { Ref, UnwrapRef } from 'vue';
1
2
  import axios from 'axios';
2
3
  import type { AxiosInstance, CreateAxiosDefaults, AxiosResponse, AxiosRequestConfig, RawAxiosRequestHeaders, InternalAxiosRequestConfig, CancelTokenSource } from 'axios';
3
4
  declare const LOCAL_REQUEST_ID = "Local-Request-Id";
@@ -121,4 +122,9 @@ export interface IApiMap {
121
122
  [name: string]: string | IRequestConfig;
122
123
  }
123
124
  export declare function createApis(map: IApiMap): Record<string, (data?: unknown, opts?: IRequestConfig<any> | undefined) => Promise<unknown>>;
125
+ export declare function useApi<R = any>(api: Promise<R>, transform?: (res: any) => R): {
126
+ data: Ref<UnwrapRef<R> | null>;
127
+ error: Ref<any>;
128
+ loading: Ref<boolean>;
129
+ };
124
130
  export { axios, LOCAL_REQUEST_ID, type AxiosRequestConfig, type AxiosResponse, type RawAxiosRequestHeaders };
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2024, VTJ.PRO All rights reserved.
3
3
  * @name @vtj/utils
4
4
  * @author CHC chenhuachun1549@dingtalk.com
5
- * @version 0.7.25
5
+ * @version 0.7.27
6
6
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
7
7
  */
8
- export declare const version = "0.7.25";
8
+ export declare const version = "0.7.27";