prescottprue / react-redux-firebase

Redux bindings for Firebase. Includes React Hooks and Higher Order Components.
https://react-redux-firebase.com
MIT License
2.55k stars 556 forks source link

feat(auth): onRedirectResult config option is able handle error case #646

Open maysam opened 5 years ago

maysam commented 5 years ago

Do you want to request a feature or report a bug?

(If this is a usage question, please do not post it here—post it on gitter. If this is not a “feature” or a “bug”, or the phrase “How do I...?” applies, then it's probably a usage question.)

What is the current behavior?

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via codesandbox or similar.

What is the expected behavior?

Which versions of dependencies, and which browser and OS are affected by this issue? Did this work in previous versions or setups?

prescottprue commented 5 years ago

What method are you calling that causes the redirect result? For example, if you are calling login, then the error should be passed back to the catch of that promise.

maysam commented 5 years ago

@prescottprue this is true with popup calls, but when we come back from a redirect, the promise is not there no more

prescottprue commented 5 years ago

@maysam The error is dispatched to state by default, so you can connect to that piece of state and display a message or redirect if that error exists. Alternatively, you should be able to set getRedirectResult directly on your Firebase instance - that is is what is being done internally, but doing it yourself outside of react-redux-firebase should also yield the success/error promise.

maysam commented 5 years ago

@prescottprue I know about this internal version, but when we have onRedirectResult in the config, it's good to also be able to handle the error in that place too

prescottprue commented 5 years ago

@maysam I'll change this to a ticket to track that as a feature