Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect on api error #6

Closed
4ware opened this issue Aug 12, 2017 · 5 comments
Closed

Redirect on api error #6

4ware opened this issue Aug 12, 2017 · 5 comments

Comments

@4ware
Copy link

4ware commented Aug 12, 2017

Hi!

When receiving an error from the api, like when the login is rejected, you just return {}, which isn't very helpfull.

How would you do it so that one could display an error to the client and rerender the form?

Cheers, Kai

@benawad
Copy link
Owner

benawad commented Aug 13, 2017

One possible option, is to put any errors in the redux state. Then in your form component, you can check if there are any errors and display a message

@4ware
Copy link
Author

4ware commented Aug 15, 2017

Would you mind to update the code for this? I don't know how... :(

@benawad
Copy link
Owner

benawad commented Aug 15, 2017

Sure. I'll code it up tomorrow

@benawad
Copy link
Owner

benawad commented Aug 17, 2017

I coded it in a separate branch: https://github.com/benawad/react-menu-monkey-client/tree/handle-login-error

I added error handling for the login page. So if a user tries to login with an invalid email or password it will stop them. I recommend taking a look at this commit: c8cab6d

It shows exactly what I changed.

@4ware
Copy link
Author

4ware commented Aug 18, 2017

Thanks a lot!

@4ware 4ware closed this as completed Aug 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants