@ciwergrp/nuxid 1.17.3 → 1.17.4
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
package/dist/module.mjs
CHANGED
|
@@ -599,7 +599,7 @@ function registerFetcherFeature(options, { from }) {
|
|
|
599
599
|
if (!options.enabled) {
|
|
600
600
|
return;
|
|
601
601
|
}
|
|
602
|
-
addImports({ name: "
|
|
602
|
+
addImports({ name: "default", as: "useCursorHttp", from });
|
|
603
603
|
addImports({ name: "APIResponseCursor", as: "APIResponseCursor", from, type: true });
|
|
604
604
|
addImports({ name: "CursorFetchOptions", as: "CursorFetchOptions", from, type: true });
|
|
605
605
|
}
|
|
@@ -19,7 +19,6 @@ export interface CursorFetchOptions<TRequest extends NitroFetchRequest = NitroFe
|
|
|
19
19
|
itemKey?: string;
|
|
20
20
|
cursorParam?: string;
|
|
21
21
|
query?: Record<string, any>;
|
|
22
|
-
key?: string;
|
|
23
22
|
}
|
|
24
23
|
export interface FetchError<TData = any> {
|
|
25
24
|
statusCode: number | undefined;
|
|
@@ -44,3 +43,4 @@ export declare function useCursorHttp<T extends Record<string, any> = any, TResp
|
|
|
44
43
|
refresh: () => Promise<void>;
|
|
45
44
|
init: () => Promise<void>;
|
|
46
45
|
}>;
|
|
46
|
+
export default useCursorHttp;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isRef, onUnmounted, readonly, ref, shallowRef, watch } from "vue";
|
|
1
|
+
import { isRef, onBeforeMount, onUnmounted, readonly, ref, shallowRef, watch } from "vue";
|
|
2
2
|
export async function useCursorHttp(url, options) {
|
|
3
3
|
function findReactiveSources(obj) {
|
|
4
4
|
const sources = [];
|
|
@@ -130,6 +130,7 @@ export async function useCursorHttp(url, options) {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
|
+
const initialFetch = () => fetchData(initialUrl, currentParams.value);
|
|
133
134
|
const pollData = async () => {
|
|
134
135
|
try {
|
|
135
136
|
const response = await fetcherFn(initialUrl, currentParams.value);
|
|
@@ -200,10 +201,12 @@ export async function useCursorHttp(url, options) {
|
|
|
200
201
|
}
|
|
201
202
|
});
|
|
202
203
|
if (immediate) {
|
|
203
|
-
if (lazy) {
|
|
204
|
-
|
|
204
|
+
if (import.meta.client && lazy) {
|
|
205
|
+
onBeforeMount(() => {
|
|
206
|
+
void initialFetch();
|
|
207
|
+
});
|
|
205
208
|
} else {
|
|
206
|
-
await
|
|
209
|
+
await initialFetch();
|
|
207
210
|
}
|
|
208
211
|
}
|
|
209
212
|
return {
|
|
@@ -217,3 +220,4 @@ export async function useCursorHttp(url, options) {
|
|
|
217
220
|
init
|
|
218
221
|
};
|
|
219
222
|
}
|
|
223
|
+
export default useCursorHttp;
|