diff options
author | Anton Tananaev <anton@traccar.org> | 2022-05-24 16:45:04 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-05-24 16:45:04 -0700 |
commit | c1bf7f8adf2d5b2206c7da2e618d4df43f3a57c2 (patch) | |
tree | 3b687541519f1ad0c3eed62ef96e13dd150fa7ce | |
parent | 804993dcfb55e536baffa160672f17b1d5224d5b (diff) | |
download | trackermap-web-c1bf7f8adf2d5b2206c7da2e618d4df43f3a57c2.tar.gz trackermap-web-c1bf7f8adf2d5b2206c7da2e618d4df43f3a57c2.tar.bz2 trackermap-web-c1bf7f8adf2d5b2206c7da2e618d4df43f3a57c2.zip |
Handle no positions
-rw-r--r-- | modern/src/common/components/ErrorHandler.js | 1 | ||||
-rw-r--r-- | modern/src/other/ReplayPage.js | 9 | ||||
-rw-r--r-- | web/l10n/en.json | 1 |
3 files changed, 9 insertions, 2 deletions
diff --git a/modern/src/common/components/ErrorHandler.js b/modern/src/common/components/ErrorHandler.js index 757a78ef..5c9c26d9 100644 --- a/modern/src/common/components/ErrorHandler.js +++ b/modern/src/common/components/ErrorHandler.js @@ -16,6 +16,7 @@ const ErrorHandler = () => { elevation={6} onClose={() => dispatch(errorsActions.pop())} severity="error" + variant="filled" > {error || previousError} </Alert> diff --git a/modern/src/other/ReplayPage.js b/modern/src/other/ReplayPage.js index 1c82c913..9277cee8 100644 --- a/modern/src/other/ReplayPage.js +++ b/modern/src/other/ReplayPage.js @@ -129,8 +129,13 @@ const ReplayPage = () => { const response = await fetch(`/api/positions?${query.toString()}`, { headers }); if (response.ok) { setIndex(0); - setPositions(await response.json()); - setExpanded(false); + const positions = await response.json(); + setPositions(positions); + if (positions.length) { + setExpanded(false); + } else { + throw Error(t('sharedNoData')); + } } else { throw Error(await response.text()); } diff --git a/web/l10n/en.json b/web/l10n/en.json index 1e915bfe..65ae7ce9 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -8,6 +8,7 @@ "sharedEdit": "Edit", "sharedRemove": "Remove", "sharedRemoveConfirm": "Remove item?", + "sharedNoData": "No data", "sharedYes": "Yes", "sharedNo": "No", "sharedKm": "km", |