Skip to content

Commit

Permalink
Fixed network error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Eleazar Meza committed Mar 5, 2020
1 parent 5f6096a commit 3db57ae
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ npm start

## Live version

A live version is available [here](https://raw.githack.com/elshaka/js-weather/react/dist/index.html)
A live version is available [here](https://raw.githack.com/elshaka/js-weather/development/dist/index.html)


## Author
Expand Down
2 changes: 1 addition & 1 deletion dist/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const fetchLocation = (location, dispatch) => {
dispatch(setWeather(formatWeather(weather)));
})
.catch(e => {
if (e.response.status === 404) {
if (e.response && e.response.status === 404) {
dispatch(setError('Location not found'));
} else {
dispatch(setError('Network error, please try again later'));
Expand Down

0 comments on commit 3db57ae

Please sign in to comment.