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 = () => {
23
23
}
24
24
} ;
25
25
26
+ const { data :users } = trpc . user . findAll . useQuery ( ) ;
27
+
26
28
return (
27
29
< >
28
30
{ ! isAdmin && < div className = 'flex h-screen items-center justify-center' >
@@ -36,7 +38,7 @@ const secret: NextPage = () => {
36
38
</ input >
37
39
< 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 >
38
40
</ div > }
39
- { isAdmin && < div > You logged in! </ div > }
41
+ { isAdmin && < div > { users ?. map ( user => < div > { user . email } </ div > ) } </ div > }
40
42
41
43
</ >
42
44
) ;
Original file line number Diff line number Diff line change @@ -18,8 +18,10 @@ export const userRouter = router({
18
18
}
19
19
} )
20
20
} ) ,
21
- getAllUsers : publicProcedure
22
- . query ( )
21
+ findAll : publicProcedure
22
+ . query ( async ( { ctx} ) => {
23
+ return await ctx . prisma . user . findMany ( ) ;
24
+ } )
23
25
} ) ;
24
26
25
27
You can’t perform that action at this time.
0 commit comments