From c1bf7f8adf2d5b2206c7da2e618d4df43f3a57c2 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 24 May 2022 16:45:04 -0700 Subject: Handle no positions --- modern/src/common/components/ErrorHandler.js | 1 + modern/src/other/ReplayPage.js | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'modern') 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} 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()); } -- cgit v1.2.3