aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/pages/Games.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/pages/Games.tsx')
-rw-r--r--frontend/src/pages/Games.tsx15
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
3import GameEntry from '../components/GameEntry'; 3import GameEntry from '../components/GameEntry';
4import { Game } from '../types/Game'; 4import { Game } from '../types/Game';
5import { API } from '../api/Api';
6import "../css/Maps.css" 5import "../css/Maps.css"
7 6
8const Games: React.FC = () => { 7interface GamesProps {
9 const [games, setGames] = React.useState<Game[]>([]); 8 games: Game[];
9}
10 10
11 const _fetch_games = async () => { 11const 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