diff options
author | Julien Veyssier <eneiluj@posteo.net> | 2020-09-25 10:42:30 +0200 |
---|---|---|
committer | Julien Veyssier <eneiluj@posteo.net> | 2020-09-28 09:58:49 +0200 |
commit | 5a6c0f64a673c4bbd872847bcfb7c90431ccb575 (patch) | |
tree | 9a82b99b5aab309bf8e3c7b2a92ca73e2841d852 /apps/weather_status/src | |
parent | bd0b28d670057bc8982560e1fb994fe3ed299d7a (diff) | |
download | nextcloud-server-5a6c0f64a673c4bbd872847bcfb7c90431ccb575.tar.gz nextcloud-server-5a6c0f64a673c4bbd872847bcfb7c90431ccb575.zip |
avoid crash when unauthenticated users make weather-related requests, mention it in UI
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
Diffstat (limited to 'apps/weather_status/src')
-rw-r--r-- | apps/weather_status/src/App.vue | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/apps/weather_status/src/App.vue b/apps/weather_status/src/App.vue index ec106e2aaba..e574bed1fb7 100644 --- a/apps/weather_status/src/App.vue +++ b/apps/weather_status/src/App.vue @@ -240,7 +240,11 @@ export default { console.info('The weather status request was cancelled because the user navigates.') return } - showError(t('weather_status', 'There was an error getting the weather status information.')) + if (err.response && err.response.status === 401) { + showError(t('weather_status', 'You are not logged in.')) + } else { + showError(t('weather_status', 'There was an error getting the weather status information.')) + } console.error(err) } }, @@ -309,8 +313,11 @@ export default { this.loading = false } } catch (err) { - showError(t('weather_status', 'There was an error setting the location address.')) - console.debug(err) + if (err.response && err.response.status === 401) { + showError(t('weather_status', 'You are not logged in.')) + } else { + showError(t('weather_status', 'There was an error setting the location address.')) + } this.loading = false } }, @@ -320,7 +327,11 @@ export default { this.address = loc.address this.startLoop() } catch (err) { - showError(t('weather_status', 'There was an error setting the location.')) + if (err.response && err.response.status === 401) { + showError(t('weather_status', 'You are not logged in.')) + } else { + showError(t('weather_status', 'There was an error setting the location.')) + } console.debug(err) } }, @@ -328,7 +339,11 @@ export default { try { await network.setMode(mode) } catch (err) { - showError(t('weather_status', 'There was an error saving the mode.')) + if (err.response && err.response.status === 401) { + showError(t('weather_status', 'You are not logged in.')) + } else { + showError(t('weather_status', 'There was an error saving the mode.')) + } console.debug(err) } }, @@ -345,7 +360,11 @@ export default { this.mode = MODE_MANUAL_LOCATION this.startLoop() } catch (err) { - showError(t('weather_status', 'There was an error using personal address.')) + if (err.response && err.response.status === 401) { + showError(t('weather_status', 'You are not logged in.')) + } else { + showError(t('weather_status', 'There was an error using personal address.')) + } console.debug(err) this.loading = false } |