From a65d6d9127c3fa7f6a8ecaec5d1ffd1f47c2bc98 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Tue, 3 Sep 2024 00:08:53 +0300 Subject: refactor: port to typescript --- frontend/src/components/pages/games.js | 62 ---------------------------------- 1 file changed, 62 deletions(-) delete mode 100644 frontend/src/components/pages/games.js (limited to 'frontend/src/components/pages/games.js') diff --git a/frontend/src/components/pages/games.js b/frontend/src/components/pages/games.js deleted file mode 100644 index 75b5e44..0000000 --- a/frontend/src/components/pages/games.js +++ /dev/null @@ -1,62 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import { useLocation, Link } from "react-router-dom"; - -import "./games.css" -import GameEntry from './game'; - -export default function Games(prop) { - const { token } = prop; - const [games, setGames] = useState([]); - const location = useLocation(); - - useEffect(() => { - document.querySelectorAll(".games-page-item-body").forEach((game, index) => { - game.innerHTML = ""; - }) - - const fetchGames = async () => { - try { - const response = await fetch("https://lp.ardapektezol.com/api/v1/games", { - headers: { - 'Authorization': token - } - }); - - const data = await response.json(); - setGames(data.data); - pageLoad(); - } catch (err) { - console.error("Error fetching games:", err); - } - }; - - fetchGames(); - - function pageLoad() { - const loaders = document.querySelectorAll(".loader"); - loaders.forEach((loader) => { - loader.style.display = "none"; - }); - } - }, [token]); - - return ( -
-
- Games list -
- -
-
-
-
-
- {games.map((game, index) => ( - - ))} -
-
-
-
- ); -} -- cgit v1.2.3