diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2024-09-09 19:29:42 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2024-09-09 19:29:42 +0300 |
| commit | 89560a61bc6e41d86acaea596762eda2da38fe50 (patch) | |
| tree | 1cf4b7c73c17f045d3f4837b480ddf7a61230a94 /frontend/src/pages/Games.tsx | |
| parent | refactor: rankings page (diff) | |
| download | lphub-89560a61bc6e41d86acaea596762eda2da38fe50.tar.gz lphub-89560a61bc6e41d86acaea596762eda2da38fe50.tar.bz2 lphub-89560a61bc6e41d86acaea596762eda2da38fe50.zip | |
refactor: upload run form, lots of random shit
Diffstat (limited to 'frontend/src/pages/Games.tsx')
| -rw-r--r-- | frontend/src/pages/Games.tsx | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/frontend/src/pages/Games.tsx b/frontend/src/pages/Games.tsx index eb7177f..ea136c2 100644 --- a/frontend/src/pages/Games.tsx +++ b/frontend/src/pages/Games.tsx | |||
| @@ -2,16 +2,13 @@ import React from 'react'; | |||
| 2 | 2 | ||
| 3 | import GameEntry from '../components/GameEntry'; | 3 | import GameEntry from '../components/GameEntry'; |
| 4 | import { Game } from '../types/Game'; | 4 | import { Game } from '../types/Game'; |
| 5 | import { API } from '../api/Api'; | ||
| 6 | import "../css/Maps.css" | 5 | import "../css/Maps.css" |
| 7 | 6 | ||
| 8 | const Games: React.FC = () => { | 7 | interface GamesProps { |
| 9 | const [games, setGames] = React.useState<Game[]>([]); | 8 | games: Game[]; |
| 9 | } | ||
| 10 | 10 | ||
| 11 | const _fetch_games = async () => { | 11 | const Games: React.FC<GamesProps> = ({ games }) => { |
| 12 | const games = await API.get_games(); | ||
| 13 | setGames(games); | ||
| 14 | }; | ||
| 15 | 12 | ||
| 16 | const _page_load = () => { | 13 | const _page_load = () => { |
| 17 | const loaders = document.querySelectorAll(".loader"); | 14 | const loaders = document.querySelectorAll(".loader"); |
| @@ -21,7 +18,9 @@ const Games: React.FC = () => { | |||
| 21 | } | 18 | } |
| 22 | 19 | ||
| 23 | React.useEffect(() => { | 20 | React.useEffect(() => { |
| 24 | _fetch_games(); | 21 | document.querySelectorAll(".games-page-item-body").forEach((game, index) => { |
| 22 | game.innerHTML = ""; | ||
| 23 | }); | ||
| 25 | _page_load(); | 24 | _page_load(); |
| 26 | }, []); | 25 | }, []); |
| 27 | 26 | ||