From b7d07f5b90a98176f4dc0cd068d16af118426702 Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Mon, 21 Jul 2025 19:11:06 -0700 Subject: [PATCH] Fixes --- src/routes/Leaderboards.tsx | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/routes/Leaderboards.tsx b/src/routes/Leaderboards.tsx index cda9ca7..fad50be 100644 --- a/src/routes/Leaderboards.tsx +++ b/src/routes/Leaderboards.tsx @@ -4,33 +4,30 @@ import axios from 'axios' import { LeaderboardEntry } from '../types/LeaderboardEntry' import { app } from '@tauri-apps/api' import { platform } from '@tauri-apps/plugin-os' -import { decrypt, encrypt } from '../util/Encryption' +import { decrypt } from '../util/Encryption' export default function Leaderboards () { const [leaderboardData, setLeaderboardData] = useState([]) + const [loading, setLoading] = useState(true) async function refresh () { + setLoading(true) setLeaderboardData([]) const launcherVersion = await app.getVersion() axios - .post( - 'https://berrydash.lncvrt.xyz/database/getTopPlayers.php', - { - [encrypt('type')]: encrypt('0') - }, - { - headers: { - Requester: 'BerryDashLauncher', - LauncherVersion: launcherVersion, - ClientPlatform: platform() - } + .get('https://berrydash.lncvrt.xyz/database/getTopPlayers.php', { + headers: { + Requester: 'BerryDashLauncher', + LauncherVersion: launcherVersion, + ClientPlatform: platform() } - ) + }) .then(res => { const decrypted = decrypt(res.data) setLeaderboardData(JSON.parse(decrypted)) }) .catch(e => console.error('Error fetching leaderboard data:', e)) + .finally(() => setLoading(false)) } useEffect(() => { @@ -41,7 +38,11 @@ export default function Leaderboards () {

Leaderboards

-
@@ -56,10 +57,14 @@ export default function Leaderboards () {

{entry.value}

)) - ) : ( + ) : loading ? (

Loading...

+ ) : ( +
+

No data...

+
)}