Is there any way/best practice to hide unavailable pages from users in SAPUI5?
Let's see an example. I have a complex application with a user login page. Here customers can login to the application, and their role data is retrieved from a backend system. Based on these roles, some users are not permitted to create a new object. Only logged in users should be able to see application pages. I'm using routing, so functionalities like edit can be accessed by direct links as well.
Currently I'm using the onRouteMatched event handler in the Component.js, which checks for the current user session storage. If the user session is not found, it redirects the request to the login page.
The problem is that it shows the requested page for one or two seconds before navigating to the login page. It's really ugly.
Where should I implement such kind of functionality? Is there any hook method for this use case?
I think I need a hook method which is called before displaying the view matched by the given route and re-direct the call to the login page. Unfortunately I couldn't find any helpful document in this topic.
Thanks!