erp-blocks 1.0.5 → 1.0.7
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/module.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useFetch, type UseFetchOptions } from '#app';
|
|
2
2
|
import type { Ref } from 'vue';
|
|
3
3
|
export type CountFetchOptions<T> = UseFetchOptions<T> & {
|
|
4
4
|
count?: {
|
|
@@ -6,6 +6,8 @@ export type CountFetchOptions<T> = UseFetchOptions<T> & {
|
|
|
6
6
|
name: string;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
interface extendedFetchReturn<T> extends Pick<ReturnType<typeof useFetch<T>>, 'data' | 'refresh' | 'execute' | 'clear' | 'error' | 'status'> {
|
|
10
10
|
count: Ref<number | undefined>;
|
|
11
|
-
}
|
|
11
|
+
}
|
|
12
|
+
export declare function useCountFetch<T>(url: string | (() => string), options: CountFetchOptions<T>): Promise<extendedFetchReturn<T>>;
|
|
13
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useFetch, useState } from "#app";
|
|
2
|
-
export function useCountFetch(url, options) {
|
|
2
|
+
export async function useCountFetch(url, options) {
|
|
3
3
|
const defaultCount = options.count ?? {
|
|
4
4
|
source: "header",
|
|
5
5
|
name: "X-Total-Count"
|
|
@@ -11,7 +11,7 @@ export function useCountFetch(url, options) {
|
|
|
11
11
|
const { count: countOpt, ...fetchOptions } = mergedOptions;
|
|
12
12
|
const count = useState(() => void 0);
|
|
13
13
|
const userOnResponse = mergedOptions.onResponse;
|
|
14
|
-
const fetch = useFetch(url, {
|
|
14
|
+
const fetch = await useFetch(url, {
|
|
15
15
|
...fetchOptions,
|
|
16
16
|
onResponse(ctx) {
|
|
17
17
|
const { response } = ctx;
|
|
@@ -33,8 +33,9 @@ export function useCountFetch(url, options) {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
-
|
|
36
|
+
const result = {
|
|
37
37
|
...fetch,
|
|
38
38
|
count
|
|
39
39
|
};
|
|
40
|
+
return result;
|
|
40
41
|
}
|