This commit is contained in:
longdayi 2025-05-27 09:07:05 +08:00
parent 2381c47ad5
commit 01cc5fe292
4 changed files with 13 additions and 3 deletions

View File

@ -17,6 +17,7 @@
"nanoid": "^5.1.5",
"node-cron": "^4.0.7",
"oidc-provider": "^9.1.1",
"superjson": "^2.2.2",
"zod": "^3.25.23"
},
"devDependencies": {

View File

@ -1,5 +1,8 @@
import { initTRPC } from '@trpc/server'
const t = initTRPC.create()
import superjson from 'superjson'
const t = initTRPC.create({
transformer: superjson,
})
export const publicProcedure = t.procedure
export const router = t.router

View File

@ -1,10 +1,13 @@
'use client';
import { useTRPC } from '@repo/client';
import { useQuery } from '@tanstack/react-query';
import { useEffect } from 'react';
export default function Home() {
const trpc = useTRPC();
const userQuery = useQuery(trpc.user.getUser.queryOptions());
console.log(userQuery.data);
const { data, isLoading } = useQuery(trpc.user.getUser.queryOptions());
useEffect(() => {
console.log(data);
}, [data]);
return <div>123</div>;
}

View File

@ -68,6 +68,9 @@ importers:
oidc-provider:
specifier: ^9.1.1
version: 9.1.1
superjson:
specifier: ^2.2.2
version: 2.2.2
zod:
specifier: ^3.25.23
version: 3.25.23