From 5524a647473b6627ee1652fa7d1257e1e7f02b38 Mon Sep 17 00:00:00 2001 From: Aurora Lahtela <24460436+AuroraLS3@users.noreply.github.com> Date: Sun, 27 Nov 2022 13:51:22 +0200 Subject: [PATCH] Implement react side of player page export --- Plan/react/dashboard/src/service/playerService.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Plan/react/dashboard/src/service/playerService.js b/Plan/react/dashboard/src/service/playerService.js index c6c9a97d4c..1d8bb6c153 100644 --- a/Plan/react/dashboard/src/service/playerService.js +++ b/Plan/react/dashboard/src/service/playerService.js @@ -1,14 +1,15 @@ import {faMapSigns} from "@fortawesome/free-solid-svg-icons"; -import {doSomeGetRequest, standard200option} from "./backendConfiguration"; +import {doSomeGetRequest, standard200option, staticSite} from "./backendConfiguration"; export const fetchPlayer = async (timestamp, uuid) => { - const url = `/v1/player?player=${uuid}×tamp=${timestamp}`; + let url = `/v1/player?player=${uuid}×tamp=${timestamp}`; + if (staticSite) url = `/player/${uuid}/player-${uuid}.json` return doSomeGetRequest(url, [ standard200option, { - status: 400, + status: staticSite ? 404 : 400, get: () => ({ - message: 'Player not found: ' + uuid + ', try another player', + message: 'Player not found: ' + uuid + ', try another player.' + (staticSite ? ' You can try the export players command.' : ''), title: '404 Player not found', icon: faMapSigns })