ar-rohman / glow

Global Weather
https://glow-forecast.web.app
0 stars 0 forks source link

Catch axios response when requesting from API #17

Closed ar-rohman closed 2 years ago

ar-rohman commented 2 years ago

Avoiding response is undefined when no internet connection (Home, Detail, Search, Setting). Change to something like this:

...
catch(error => {
  if (!error.response) {
      this.errorStatus = 'Error: Network Error';
  } else {
      this.errorStatus = error.response.data.message;
  }
});
...