nextjs middleware trpc authentication
When I use trpc in a server action for a server component, if auth fails and throws a
my nextjs middleware already reroutes to a 404 page if the requesting page is not found. how do I reroute to an authorized page for every server action with trpc?
in
but it is supposed to be
new TRPCError({ code: 'UNAUTHORIZED' }); in the backend, how do I wrap that in nextjs middleware? my nextjs middleware already reroutes to a 404 page if the requesting page is not found. how do I reroute to an authorized page for every server action with trpc?
in
middleware.ts it says that the request is getting captured at this location for some reason _nextjs_original-stack-framebut it is supposed to be
/api/trpc