trpc global onError

i have trpc middleware logic that throws a code UNAUTHORIZED error if a user is not authenticated. when a trpc call happens i want to redirect the user to /login if they're unauthorized. i could add the redirect logic to all the api calls using onError, but wondering if there's an easier way to do this in one place
1 Reply

Did you find this page helpful?