Hi guys im trying to build an application which has roles based dynamic menus , every time the user logs in ill get the menus list from api and render the menus, the menus have 2 level of submenus , now since its a role based application i want to restrict the users from accessing the routes that they are not authorized for.
my doubt here is, what is the best way to handle this? can some of you share your experience on handling this scenario?
please let me know of the best practices and the best approach for this.
My initial taught was to apply auth guard for every component in the route (over 50 components are there) and then inside the auth.guard.ts ill just call the menus api initially and check the route is present in it and return true if its present .
Im pretty sure this is not the best approach, so please help.