james162861
Explore posts from serversDTDrizzle Team
•Created by james162861 on 9/28/2024 in #help
MySQL Spatial Data Schema
Does anyone know how to set up a point type in a MySQL schema? I want to take advantage of spatial indexes and spatial helper functions.
Currently, I am using latitude and longitude coordinates and doing some funky sin and cosine math to get all entities in a radius
2 replies
TTCTheo's Typesafe Cult
•Created by james162861 on 8/16/2024 in #questions
Express-Like Auth Middleware Pattern For Server Actions?
Since all server actions should be authenticated, I have sprinkled clerk's auth() function at the top of every single action's function body. This seems silly. I liked how Express allows you to apply an auth middleware to collections of routes. For instance:
One possible solution is to extract the auth into a wrapper function and wrap each server action with it. Still a alot of repetition. Another solution could be to export the protected server actions to an index file and wrap that the withAuth wrapper function.
Are there any other patters? I love server actions, but am missing traditional auth middleware.
11 replies
TTCTheo's Typesafe Cult
•Created by james162861 on 1/31/2024 in #questions
Call post.hello on button click
Hi, I know that trpc is using React useQuery under the hood in T3 on the client and therefore can only be used in a React component body. But, I am wondering if there is a way to modify the router call a trpc procedure on a button click in a client component.
I realize that I can make a fetch request to
http://localhost:3000/api/trpc/post.test
, but this defeats the point of TRPC.7 replies