2023-12-23 15:00:20 +01:00
|
|
|
type KeysOf<T> = Array<T extends T ? keyof T extends string ? keyof T : never : never>;
|
|
|
|
|
|
|
|
export function useGAsyncData<ResT, DataE = Error, DataT = ResT, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>(...params: Parameters<typeof useAsyncData<ResT, DataE, DataT, PickKeys, DefaultT>>): ReturnType<typeof useAsyncData<ResT, DataE, DataT, PickKeys, DefaultT>> {
|
2023-12-23 14:21:33 +01:00
|
|
|
if (!params[2]) {
|
|
|
|
params[2] = {};
|
|
|
|
}
|
2023-12-24 16:57:53 +01:00
|
|
|
params[2].getCachedData = (key) => useNuxtData(key).data.value ?? undefined;
|
2023-12-23 14:21:33 +01:00
|
|
|
|
2023-12-23 15:00:20 +01:00
|
|
|
return useAsyncData<ResT, DataE, DataT, PickKeys, DefaultT>(...params);
|
2023-12-23 14:21:33 +01:00
|
|
|
}
|