mirror of
https://github.com/ArthurDanjou/trpc-nuxt.git
synced 2026-01-14 12:14:40 +01:00
reinstall deps
This commit is contained in:
@@ -51,25 +51,14 @@ export async function useAsyncQuery<
|
||||
): Promise<AsyncData<PickFrom<ReturnType<Transform>, PickKeys>, TError>> {
|
||||
const { $client } = useNuxtApp()
|
||||
const key = getQueryKey(pathAndInput)
|
||||
const serverError = useState<TError | null>(`error-${key}`, () => null)
|
||||
const { error, data, ...rest } = await useAsyncData(
|
||||
const result = await useAsyncData(
|
||||
key,
|
||||
() => $client.query(...pathAndInput),
|
||||
// @ts-expect-error: Internal
|
||||
options,
|
||||
)
|
||||
|
||||
if (error.value && !serverError.value)
|
||||
serverError.value = error.value as any
|
||||
|
||||
if (data.value)
|
||||
serverError.value = null
|
||||
|
||||
return {
|
||||
...rest,
|
||||
data,
|
||||
error: serverError,
|
||||
} as any
|
||||
return result
|
||||
}
|
||||
|
||||
export function useClient(): TRPCClient<AppRouter> {
|
||||
|
||||
Reference in New Issue
Block a user