optional authenticated tRPC function

Hi, how can I build a function that can handle a user possibly signed in?
I feel like it’s pretty common pattern, but I fine myself defining 2 functions that are basically the same, one for authenticated users and one for unauthenticated.
Thanks for the help
Was this page helpful?