joshgeller / react-redux-jwt-auth-example

Sample project showing possible authentication flow using React, Redux, React-Router, and JWT
MIT License
1.58k stars 237 forks source link

Handle "Failed to fetch" error #16

Closed pl12133 closed 8 years ago

pl12133 commented 8 years ago

Problem:

I ran this demo on a remote server, so the host name I used was different from localhost. Therefore I got an Error 102: Connection Refused because no server was running on localhost. The demo failed on this error, and the Submit button would remain disabled until refreshing the page.

Error Screenshot:

error screenshot

Solution:

If the error has no response property, fill it with response.status and response.statusText. I chose Status 102 because that is the error I was getting, however Status 102 is not explicitly linked to Failure to fetch.

pl12133 commented 8 years ago

Accidentally pushed a lot more to my fork. Closing this for now and you can cherry pick @2910683 if you feel like this issue needs fixing.