erikras / react-redux-universal-hot-example

A starter boilerplate for a universal webapp using express, react, redux, webpack, and react-transform
MIT License
12.01k stars 2.5k forks source link

Firebase Middleware on Redux - Follow up on "react-redux-universal-hot-example" (Firebase login example) #1095

Open markopavlovic opened 8 years ago

markopavlovic commented 8 years ago

Hi there, as I was getting back into React again and taking this stack for a tryout together with a newbie colleague, I made a simple gist showcasing how to replace the examples API login with the Firebase and how to implement Firebase Middleware with same pattern as clientMiddleware.

Maybe not the best example, but hope it helps someone, it for sure would help me if I ran into one :)

Cheers!

https://gist.github.com/markopavlovic/b71f098e27e2057aa418bcc64025e2e6

jaraquistain commented 8 years ago

@markopavlovic I got a 404 from the above link

markopavlovic commented 8 years ago

@jaraquistain updated :)

juanbiltes commented 8 years ago

Hi @markopavlovic , I was just trying this and it looks as I loose state at refresh, have you found this also? If so how did you solve itß

Thanks a lot!

markopavlovic commented 8 years ago

Hi @juankahuna, you will need to Firebase.getAuth() - https://www.firebase.com/docs/web/api/firebase/getauth.html to get the current auth state from the user. You will than need to make a general check for users state and dispatch login action on refresh.

Hope this helps, I might do a gist addition for that also.