ffxsam / ffx-meteor-react-boilerplate

Meteor 1.4 + React boilerplate (DEPRECATED/ABANDONED) 👋
133 stars 20 forks source link

Extend example to include accounts logic #19

Closed nadeemja closed 8 years ago

nadeemja commented 8 years ago

Hi,

This is the best guide for Meteor+React+Redux right now on the entire web. Many thanks to you for this wonderful repo.

There is, however, something I still do not understand: How should the register/login/logout flows be implemented?

Forgive me if this has been answered or is too obvious. I tried and failed to find the answers, so I'm asking here.

Thanks again.

ffxsam commented 8 years ago

Thanks for the kind words, Nadeem!

There's no one right way to make an account registration/login/logout flow. There are probably some wrong ways to do it (like having the router handling reactively whether the user is logged in or not). It should probably be handled in the container level.

One approach would be to put a user authentication check in the layout component that wraps all your pages. If the user is not logged in, you return a login/signup box instead of the actual page content.

nadeemja commented 8 years ago

Thanks for the swift and succinct reply, @ffxsam!

I'll try to experiment with your suggestions.

If you don't mind, could I request that you include some examples of routing actions, for example FlowRouter.go(), in your examples branch?

And, how would one keep route synced with Redux store?

ffxsam commented 8 years ago

I'll get around to it soon, right now I don't have any time. But some time I'd like to redo the example app to be something more useful and robust. I'll definitely include account creation, and I'll probably move away from FlowRouter and use React Router instead.

Cheers!