File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ const secret: NextPage = () => {
2323 }
2424 } ;
2525
26+ const { data :users } = trpc . user . findAll . useQuery ( ) ;
27+
2628 return (
2729 < >
2830 { ! isAdmin && < div className = 'flex h-screen items-center justify-center' >
@@ -36,7 +38,7 @@ const secret: NextPage = () => {
3638 </ input >
3739 < button onClick = { clickHandler } className = "blockrounded-md border rounded border-transparent bg-rose-500 px-5 py-3 text-base font-medium text-white shadow hover:bg-rose-600 focus:outline-none focus:ring-2 focus:ring-rose-500 focus:ring-offset-2 sm:px-10" > Submit</ button >
3840 </ div > }
39- { isAdmin && < div > You logged in! </ div > }
41+ { isAdmin && < div > { users ?. map ( user => < div > { user . email } </ div > ) } </ div > }
4042
4143 </ >
4244 ) ;
Original file line number Diff line number Diff line change @@ -18,8 +18,10 @@ export const userRouter = router({
1818 }
1919 } )
2020 } ) ,
21- getAllUsers : publicProcedure
22- . query ( )
21+ findAll : publicProcedure
22+ . query ( async ( { ctx} ) => {
23+ return await ctx . prisma . user . findMany ( ) ;
24+ } )
2325} ) ;
2426
2527
You can’t perform that action at this time.
0 commit comments