diff --git a/app/routes/hammer.tsx b/app/routes/hammer.tsx index 64f196b..d056e4b 100644 --- a/app/routes/hammer.tsx +++ b/app/routes/hammer.tsx @@ -3,6 +3,7 @@ import { Button, Card, CardBody, + CardFooter, CardHeader, Container, Flex, @@ -61,6 +62,7 @@ export default function () { const [avatarUrl, setAvatarUrl] = useState(""); const [ticketLink, setTicketLink] = useState(""); const [history, setHistory] = useState([] as ReactElement[]); + const [saveData, setSaveData] = useState({} as { [k: string]: any }); const [loading, setLoading] = useState(false); const { isOpen, onClose, onOpen } = useDisclosure(); const toast = useToast(); @@ -166,6 +168,28 @@ export default function () { setVisible(true); } + async function getSaveData() { + const dataResp = await fetch(`/api/game-bans/${uid}/save-data`); + + if (!dataResp.ok) { + let msg = "Unknown error"; + + try { + msg = ((await dataResp.json()) as { error: string }).error; + } catch {} + + toast({ + description: msg, + status: "error", + title: "Failed to get save data", + }); + + return; + } + + setSaveData(await dataResp.json()); + } + const invalidIcon = ( - + @@ -326,9 +350,43 @@ export default function () { + + await getSaveData()}> + Click to Display Save Data + + {history} + + + + } mt="8px" spacing="6"> + + Money + + {saveData.Money} + + + + Parts + + {saveData.Parts} + + + + Wins + + {saveData.Wins} + + + + + + ); }