Implement react side of player page export

This commit is contained in:
Aurora Lahtela 2022-11-27 13:51:22 +02:00
parent 801f51d823
commit 5524a64747
1 changed files with 5 additions and 4 deletions

View File

@ -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}&timestamp=${timestamp}`;
let url = `/v1/player?player=${uuid}&timestamp=${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
})