Admin routes and security. How to set this up?
Hi! What is a good way of protecting admin routes? The ideal situation is, that whenever an user goes to an admin route it:
1. Does not fetch the data
2. Will get redirected back to a specific page
Right now when I throw a TRPC error, it takes a super long time until the error is shown.. It fetches like 7-8 times and returns error = null
admin route:
4 Replies
from the creator of tRPC
So no... this what you have is the best you can do with trpc
However, you can make it so that the whole page shouldn't be accessed by user's other than the admin
you should check if the user is an admin when he comes to the page, and if he isn't redirect him then
no need to wait untill api call
Ok thanks 🙂