I've now got 100+ such routes in this file -- many of which are only relevant for certain users (such as an admin). Is there a way to dynamically import that route, but ONLY if the user is an admin? It's easy enough to dynamically import a file containing all the admin routes, but unless I do that as part of the main package, the admin page I'm trying to visit will result in a 404.
Hi there, I've got one big
router.js
file that has a whole bunch of routes inside it. For example:I've now got 100+ such routes in this file -- many of which are only relevant for certain users (such as an admin). Is there a way to dynamically import that route, but ONLY if the user is an admin? It's easy enough to dynamically import a file containing all the admin routes, but unless I do that as part of the main package, the admin page I'm trying to visit will result in a 404.
Appreciate any guidance!
J