Redirect After Launch - Best Practice?


#1

My app has a launch screen, login screen, and a home screen. If a user closes out the app without logging out, I want them to see the launch screen and be redirected to the home screen instead of the login screen. I’m storing login info in ApplicationSettings and clearing it out if they logout, so my current solution is to have logic in my router which sets the starting page to either the login or home screen depending on the contents of ApplicationSettings. Is there a better way to do this?


#2

I believe you are using Angular since you mentioned Router. Use Router Guards on Home page, set your default route to home. In the canActivate implementation return false if user doesn’t have a valid session info in application settings and redirect to Login page.