This commit is contained in:
Lukian LEIZOUR 2024-06-05 22:48:47 +02:00
parent 7ebfa38753
commit 1c1dd559ef
3 changed files with 12 additions and 5 deletions

7
public/404.html Normal file
View file

@ -0,0 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; url=/" />
</head>
<body></body>
</html>

View file

@ -53,7 +53,6 @@ body {
.games {
display: flex;
flex-direction: column;
margin: 20px;
gap: 20px;
}
@ -61,6 +60,7 @@ body {
padding: 30px;
background-color: white;
display: flex;
align-items: start;
border-radius: 60px;
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.5);
justify-content: space-between;

View file

@ -1,4 +1,4 @@
import { useState, useEffect } from 'react';
import { useState, useEffect, useRef } from 'react';
import { useNavigate } from "react-router-dom";
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import axios from "axios";
@ -13,7 +13,7 @@ export default function Home() {
const [token, setToken] = useState();
const [games, setGames] = useState([]);
const [userloading, setUserLoading] = useState(true);
const [gameLoading, setGameLoading] = useState(true);
const [gamesLoading, setGamesLoading] = useState(true);
const [name, setName] = useState("");
const [currentPage, setCurrentPage] = useState(1);
@ -38,7 +38,7 @@ export default function Home() {
} catch (error) {
console.error("Error fetching games:", error);
} finally {
setGameLoading(false);
setGamesLoading(false);
}
}
@ -106,7 +106,7 @@ export default function Home() {
<FontAwesomeIcon icon="fa-solid fa-angles-right" />
</button>
</div>
{gameLoading ? <p>Loading...</p> :
{gamesLoading ? <p>Loading...</p> :
<div className='games'>
{currentGames.map((game) => {
return <Game key={game.id} game={game} token={token} user={user} />