diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2024-10-30 00:57:58 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2024-10-30 00:57:58 +0300 |
| commit | 41b1dbdf6febc44b162f583eb614fad3ed8891d0 (patch) | |
| tree | 6aaddd34b14b677124cd806e59fdc0829d7c5d50 /frontend/src | |
| parent | frontend: HOW is h2 bigger than h1 i really hate our css (diff) | |
| download | lphub-41b1dbdf6febc44b162f583eb614fad3ed8891d0.tar.gz lphub-41b1dbdf6febc44b162f583eb614fad3ed8891d0.tar.bz2 lphub-41b1dbdf6febc44b162f583eb614fad3ed8891d0.zip | |
frontend: fix switching maps but not updating
Diffstat (limited to 'frontend/src')
| -rw-r--r-- | frontend/src/api/Maps.tsx | 2 | ||||
| -rw-r--r-- | frontend/src/pages/Maps.tsx | 4 |
2 files changed, 1 insertions, 5 deletions
diff --git a/frontend/src/api/Maps.tsx b/frontend/src/api/Maps.tsx index 80f88d4..fc50293 100644 --- a/frontend/src/api/Maps.tsx +++ b/frontend/src/api/Maps.tsx | |||
| @@ -10,12 +10,10 @@ export const get_map_summary = async (map_id: string): Promise<MapSummary> => { | |||
| 10 | 10 | ||
| 11 | export const get_map_leaderboard = async (map_id: string): Promise<MapLeaderboard | undefined> => { | 11 | export const get_map_leaderboard = async (map_id: string): Promise<MapLeaderboard | undefined> => { |
| 12 | const response = await axios.get(url(`maps/${map_id}/leaderboards`)); | 12 | const response = await axios.get(url(`maps/${map_id}/leaderboards`)); |
| 13 | console.log(response) | ||
| 14 | if (!response.data.success) { | 13 | if (!response.data.success) { |
| 15 | return undefined; | 14 | return undefined; |
| 16 | } | 15 | } |
| 17 | const data = response.data.data; | 16 | const data = response.data.data; |
| 18 | console.log(data.records) | ||
| 19 | // map the kind of leaderboard | 17 | // map the kind of leaderboard |
| 20 | data.records = data.records.map((record: any) => { | 18 | data.records = data.records.map((record: any) => { |
| 21 | if (record.host && record.partner) { | 19 | if (record.host && record.partner) { |
diff --git a/frontend/src/pages/Maps.tsx b/frontend/src/pages/Maps.tsx index 13ee4d9..bc939cf 100644 --- a/frontend/src/pages/Maps.tsx +++ b/frontend/src/pages/Maps.tsx | |||
| @@ -37,8 +37,6 @@ const Maps: React.FC<MapProps> = ({ token, isModerator }) => { | |||
| 37 | 37 | ||
| 38 | const _fetch_map_leaderboards = async () => { | 38 | const _fetch_map_leaderboards = async () => { |
| 39 | const mapLeaderboards = await API.get_map_leaderboard(mapID); | 39 | const mapLeaderboards = await API.get_map_leaderboard(mapID); |
| 40 | console.log("lbs:") | ||
| 41 | console.log(mapLeaderboards); | ||
| 42 | setMapLeaderboardData(mapLeaderboards); | 40 | setMapLeaderboardData(mapLeaderboards); |
| 43 | }; | 41 | }; |
| 44 | 42 | ||
| @@ -51,7 +49,7 @@ const Maps: React.FC<MapProps> = ({ token, isModerator }) => { | |||
| 51 | _fetch_map_summary(); | 49 | _fetch_map_summary(); |
| 52 | _fetch_map_leaderboards(); | 50 | _fetch_map_leaderboards(); |
| 53 | _fetch_map_discussions(); | 51 | _fetch_map_discussions(); |
| 54 | }, []); | 52 | }, [mapID]); |
| 55 | 53 | ||
| 56 | if (!mapSummaryData) { | 54 | if (!mapSummaryData) { |
| 57 | // loading placeholder | 55 | // loading placeholder |