From 8cf4d99eeb6d999750f1bf05cd725650a0dae663 Mon Sep 17 00:00:00 2001 From: OpenInt Bot Date: Fri, 21 Feb 2025 07:18:32 -0800 Subject: [PATCH] Add debug page showing trpc client working --- apps/web/app/-debug/page.tsx | 30 +++++++++++++++++++ apps/web/app/_debug/page.tsx | 58 ------------------------------------ 2 files changed, 30 insertions(+), 58 deletions(-) create mode 100644 apps/web/app/-debug/page.tsx delete mode 100644 apps/web/app/_debug/page.tsx diff --git a/apps/web/app/-debug/page.tsx b/apps/web/app/-debug/page.tsx new file mode 100644 index 00000000..b5462a8b --- /dev/null +++ b/apps/web/app/-debug/page.tsx @@ -0,0 +1,30 @@ +'use client' + +import {_trpcReact} from '@openint/engine-frontend' +import 'next/image' +import '../global.css' +import {QueryClientProvider} from '@tanstack/react-query' +import React from 'react' +import {TRPCProvider} from '@openint/engine-frontend' +import {createQueryClient} from '@/lib-client/react-query-client' + +function DebugInner() { + const res = _trpcReact.listConnectorMetas.useQuery({}) + return ( +
+
{JSON.stringify(res.data, null, 2)}
+
+ ) +} + +export default function Debug() { + const {current: queryClient} = React.useRef(createQueryClient()) + return ( + + + + hello + + + ) +} diff --git a/apps/web/app/_debug/page.tsx b/apps/web/app/_debug/page.tsx deleted file mode 100644 index 5b151a40..00000000 --- a/apps/web/app/_debug/page.tsx +++ /dev/null @@ -1,58 +0,0 @@ -'use client' - -import 'next/image' -import '../global.css' -import {SchemaForm} from '@/../../packages/ui' -import {z} from '@/../../packages/util' - -// TODO: Improve the rendering of discriminated union. In particular -const schemas = { - dunion: z.discriminatedUnion('type', [ - z.object({ - type: z.literal('oauth'), - clientId: z.string().min(2), - clientSecret: z.string().min(2), - }), - z.object({type: z.literal('apikey')}), - ]), - oneof: z.union([ - z.object({ - type: z.literal('oauth'), - clientId: z.string(), - clientSecret: z.string(), - }), - z.object({type: z.literal('apikey')}), - ]), - nullish: z.object({ - oauth: z - .union([ - z - .object({ - clientId: z.string(), - clientSecret: z.string(), - }) - .describe('Configure oauth'), - z.null().describe('No oauth'), - ]) - .optional() - .describe('Oauth support'), - apikeyAuth: z.boolean().optional().describe('API key auth support'), - }), -} - -export default function Demo() { - return ( -
- { - console.log('schema', schema) - return schema - }} - /> -
- ) -}