reactjs - How to handle logged in status using React Router? -


i'm noob, starting first project node, express, , react.

i got authentication working, have component calls action, calls store (or should), confused. don't know go.

my loginactions.login makes api call login user, comes , stores cookie session id. after that, how tell ui go dashboard? how make ui know user authenticated, , if it's not, kick him out?

where supposed check that? store? component itself?

any appreciated.

you're not "supposed" in specific way. react more of library framework. can use see fit.

one option use react-router's onenter function verify logged in status , user it's replace method redirect accordingly.

you have components verify logged in status , instead render login form if not logged in yet.

or store login form @ unique uri , handle all of authentication via server, using 302 redirects based on logged in status.

up you!


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo