Now that we have a conditional in for the admin button, we need to do the same for all of the admin routes because currently, they are still accessible to everyone.
We will set up a function to check if the user is an admin when accessing a route. If they are an admin, they will be able to proceed. If they are not, it will force a logout request which will redirect them.
Why do we need to await requireAdminUser(request);
on all pages in the admin folder? (index and new). I assumed it would be enough to do it only in the admin.tsx file (and indeed, it seems to work). Am I missing something? Aren't the loader of the parent route called anyways?
oh well, I should have just listened until the end of the video. too eager once again.