diff options
author | Anton Tananaev <anton@traccar.org> | 2022-04-17 15:38:40 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-04-17 15:38:40 -0700 |
commit | ad8484a08ef7eabb41afb33a9774ba8502da1d53 (patch) | |
tree | 957204d055150ee29251b24b28a9ed1d0afe88d0 /modern/src/PositionPage.js | |
parent | 914f3dae0e34304eebbfaae2b7740e53206ce527 (diff) | |
download | trackermap-web-ad8484a08ef7eabb41afb33a9774ba8502da1d53.tar.gz trackermap-web-ad8484a08ef7eabb41afb33a9774ba8502da1d53.tar.bz2 trackermap-web-ad8484a08ef7eabb41afb33a9774ba8502da1d53.zip |
Handle query parameters
Diffstat (limited to 'modern/src/PositionPage.js')
-rw-r--r-- | modern/src/PositionPage.js | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/modern/src/PositionPage.js b/modern/src/PositionPage.js index 37b0145f..08502668 100644 --- a/modern/src/PositionPage.js +++ b/modern/src/PositionPage.js @@ -29,14 +29,12 @@ const PositionPage = () => { useEffectAsync(async () => { if (id) { - const response = await fetch(`/api/positions?id=${id}`, { - headers: { - Accept: 'application/json', - }, - }); + const response = await fetch(`/api/positions?id=${id}`); if (response.ok) { - const items = await response.json(); - setItem(items[0]); + const positions = await response.json(); + if (positions.length > 0) { + setItem(positions[0]); + } } } else { setItem({}); |