bananaoomarang / isomorphic-redux

Isomorphic Redux demo, with routing and async actions
https://medium.com/@bananaoomarang/handcrafting-an-isomorphic-redux-application-with-love-40ada4468af4
MIT License
455 stars 87 forks source link

Authentication and client side fetch #26

Closed Dattaya closed 8 years ago

Dattaya commented 8 years ago

@bananaoomarang would you like to make part 2 of your tutorial? I can send you the implementation of authentication and fetching for the transition on the client. Your repository is still going to be very simple compared to react-redux-universal-hot-example.

bananaoomarang commented 8 years ago

Yeah sure, maybe we can just put what's here on a branch/link to a fork of yours as an example. Feel free to write whatever and link to mine as a part one. Just don’t want the code here to differ too much from what's in the tutorial.

suancarloj commented 8 years ago

@Dattaya could you already share the authentification implementation based on this tutorial ?

Dattaya commented 8 years ago

@suancarloj I'll publish a draft in a few days.

suancarloj commented 8 years ago

Awesome, thanks :)

Dattaya commented 8 years ago

So here it comes–https://github.com/Dattaya/isomorphic-redux/tree/client-fetch-and-auth I hope it will be helpful somehow. If you or anyone else have an idea how to improve it(without turning it into a react-redux-universal-hot-example, we need an example for beginners) or simplify it even further, your advice and prs are very welcome.

sachalifs commented 8 years ago

@Dattaya I really like your example with client fetch and auth and how you used shouldComponentUpdate on the client, found it really helpful! :+1:

Dattaya commented 8 years ago

I'm very glad to hear that, @slifszyc. I'll continue to further improve this example.

sachalifs commented 8 years ago

yup, I think I'll be using it as a boilerplate for a new app I'm working on, thanks again!

Dattaya commented 8 years ago

This discussion has been opened for a very long time, it's time to close it, but before I do that, I would like to list some of the differences between the repositories. New functionality in isomorphic-redux-plus:

To see it in action uncomment either // return res.sendStatus(500); or // return res.sendStatus(404); in api.js. Then you can load the todos page directly, or load the about page and click on "todos". In the former case server should return an appropriate status code:

todos_error

If you need to show an error page not in response to an api call fail but manually based on some condition, you can do that too by dispatching a setStatus action.

and several other minor changes.