I have applied role-based authorization on the user who is logged in. The JWT token is getting stored in localStorage and routes getting access based on Login and auth.guard.ts.
But in addition to this certain users need to access some components that others with the same role don't. A JSON
array is defining which routes users can access even after login.
What I have defined to get this done is to check on the ngOnInit
of the component. If the component is present in the array, it should be allowed to access other 404 page
has to be displayed.
But seems like I am not finding this way as an effective way to do so.
Please suggest any improvisation I can do with illustration. Would like to do everything to be done in the right way.