How can I globally manage errors in tRPC ? Trying `redirect` in custom link does not seem to work
I want to be able to redirect a user when they become unauthenticated. Someone else mentioned to create some NextJS middleware which makes an API call for the user but then that will make an extra API call for every tRPC request. It feels like there should be someway I can centrally manage errors where if tRPC returns an 'UNAUTHORIZED' error for any procedure I can do a redirect to '/login'
I have a monorepo with everything together but the apps will be deployed separately eventually.
I've tested this custom link before the
Is it something to do with the error still being thrown ?
I have a monorepo with everything together but the apps will be deployed separately eventually.
I've tested this custom link before the
httpLink but the redirect does not seem to ever run. The console logs as expected. Is it something to do with the error still being thrown ?
