Closed therealmarv closed 8 years ago
Right now, due to the initial set of routes being setup during bootstrap, it wouldn't be possible to have an in-memory session change cause an automatic navigation to a logged-in route or logged-out route.
To have the appropriate route load during refresh, you'd want to modify the common session component to read from a source that has the accurate session state during page load, whether it's a global variable or a JSONP callback.
I'm having a issue with this too, may we have a simple example or something? Thanks!
Modify session.js to read some global property injected by the Express back-end (using something like Jade templates to serve the main index page) that represents the current session. If it's falsy, then the logged-out routes will be loaded by main.jsx, otherwise the logged-in routes will be used.
I will pin this here. This is an example which is using React & normal Flux dealing with login. Hopefully it well help somebody: https://auth0.com/blog/2015/04/09/adding-authentication-to-your-react-flux-app/ https://github.com/auth0/react-flux-jwt-authentication-sample
I've taken this template and added a simple button on it to change user state (from false/logged off to true/logged on).
But how can I route and let the user switch from homepage to the landing page? I cannot get away from landing page or homepage.
So basically... how do I make the page refresh with a logged in (user=true) status?