From 491c04739a547bfb0c5e30c80d42a7332baa2914 Mon Sep 17 00:00:00 2001 From: wobsoriano Date: Sun, 18 Dec 2022 16:14:59 -0800 Subject: [PATCH] cleanup --- playground/plugins/trpc-client.ts | 14 +++++++------- src/client/index.ts | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/playground/plugins/trpc-client.ts b/playground/plugins/trpc-client.ts index 1b7e1c1..4b449a0 100644 --- a/playground/plugins/trpc-client.ts +++ b/playground/plugins/trpc-client.ts @@ -1,4 +1,4 @@ -import { createTRPCProxyClient, httpBatchLink, loggerLink } from '@trpc/client' +import { httpBatchLink, loggerLink } from '@trpc/client' import superjson from 'superjson' import { FetchError } from 'ofetch' import { createTRPCNuxtClient } from 'trpc-nuxt/client' @@ -10,18 +10,18 @@ export default defineNuxtPlugin(() => { transformer: superjson, links: [ // adds pretty logs to your console in development and logs errors in production - // loggerLink({ - // enabled: opts => - // process.env.NODE_ENV === 'development' || - // (opts.direction === 'down' && opts.result instanceof Error) - // }), + loggerLink({ + enabled: opts => + process.env.NODE_ENV === 'development' || + (opts.direction === 'down' && opts.result instanceof Error) + }), httpBatchLink({ url: '/api/trpc', headers () { return headers }, fetch: (input, options) => - $fetch.raw(input.toString(), options) + globalThis.$fetch.raw(input.toString(), options) .catch((e) => { if (e instanceof FetchError && e.response) { return e.response } throw e diff --git a/src/client/index.ts b/src/client/index.ts index b1a9ae0..1717aba 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -1,11 +1,11 @@ -import { type CreateTRPCClientOptions, type inferRouterProxyClient, createTRPCProxyClient, httpBatchLink as _httpBatchLink } from '@trpc/client' +import { type CreateTRPCClientOptions, type inferRouterProxyClient, createTRPCProxyClient } from '@trpc/client' import { type AnyRouter } from '@trpc/server' import { createFlatProxy, createRecursiveProxy } from '@trpc/server/shared' import { hash } from 'ohash' import { nanoid } from 'nanoid' import { type DecoratedProcedureRecord } from './types' // @ts-expect-error: Nuxt auto-imports -import { getCurrentInstance, onScopeDispose, useAsyncData, useRequestHeaders, ref, unref } from '#imports' +import { getCurrentInstance, onScopeDispose, useAsyncData, ref, unref } from '#imports' /** * Calculates the key used for `useAsyncData` call