@anweb/nuxt-ancore 1.5.1 → 1.7.0
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,8 +1,9 @@
|
|
|
1
|
-
import type { NitroFetchRequest } from 'nitropack';
|
|
1
|
+
import type { NitroFetchOptions, NitroFetchRequest } from 'nitropack';
|
|
2
2
|
import { type Ref, type ComputedRef } from 'vue';
|
|
3
3
|
import { useAsyncData } from '#app';
|
|
4
4
|
interface TConfig {
|
|
5
5
|
request: NitroFetchRequest;
|
|
6
|
+
apiConfig?: NitroFetchOptions<string>;
|
|
6
7
|
}
|
|
7
8
|
interface TUseAnData<TData, TError> {
|
|
8
9
|
init: () => Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NitroFetchRequest } from 'nitropack';
|
|
1
|
+
import type { NitroFetchOptions, NitroFetchRequest } from 'nitropack';
|
|
2
2
|
import { type UseEventBusReturn } from '@vueuse/core';
|
|
3
3
|
import type { TWS as TWSDefault } from '#ancore/types';
|
|
4
4
|
interface TConfig<TData, TFilter, TWS extends TWSDefault> {
|
|
@@ -13,6 +13,7 @@ interface TConfig<TData, TFilter, TWS extends TWSDefault> {
|
|
|
13
13
|
type: TWS['type'];
|
|
14
14
|
callback: (list: TData[], count: number, data: any) => number | void;
|
|
15
15
|
}[];
|
|
16
|
+
apiConfig?: NitroFetchOptions<string>;
|
|
16
17
|
}
|
|
17
18
|
declare const _default: <TData, TFilter = unknown, TWS extends TWSDefault = TWSDefault>(config: TConfig<TData, TFilter, TWS>) => {
|
|
18
19
|
init: (newFilter?: TFilter) => Promise<void>;
|
|
@@ -65,7 +65,10 @@ export default (config) => {
|
|
|
65
65
|
status
|
|
66
66
|
} = useAsyncData(
|
|
67
67
|
key,
|
|
68
|
-
() => userApi(
|
|
68
|
+
() => userApi(
|
|
69
|
+
config.request,
|
|
70
|
+
{ method: "GET", query: filter.value, ...config.apiConfig || {} }
|
|
71
|
+
),
|
|
69
72
|
{ immediate: false }
|
|
70
73
|
);
|
|
71
74
|
watch(data, refresh);
|