3 ms·
Should I be using the RedirectRoute widget when I want to redirect to a login page? I want to check a user object to see if the user is logged in, I would like
by howler9443 9y ago
Should I be using the RedirectRoute widget when I want to redirect to a login page? I want to check a user object to see if the user is logged in, I would like to bind the url to the login and redirect. I am using AWS Cognito hosted UI so I can't slip it into an iframe. Any suggestions would be most appreciated.
Thanks
- mstijak 9y agoInformation about the logged in user can usually be read from a cookie or localStorage. You can put that info in the store or use it on the route like this: <RedirectRoute visible={()=>!userIsSignedIn()} redirect="~/sign-in" /> I'm not aware if AWS Cognito hosted UI offers info about the user or you need implement that on your own. Firebase offers the onAuthStateChanged callback which is used in this app. https://github.com/codaxy/dashboards/blob/master/app/layout/UserAccount.js https://github.com/codaxy/dashboards/blob/master/app/layout/...