From bfc765e56b5b15e0d08df4aaeb1cde6d8699bed0 Mon Sep 17 00:00:00 2001 From: iyanfdezz Date: Mon, 1 Apr 2024 17:02:37 +0200 Subject: [PATCH] =?UTF-8?q?Eliminado=20el=20timeout=20de=20las=20estadisti?= =?UTF-8?q?cas,=20a=C3=B1adido=20bot=C3=B3n=20de=20buscar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapp/src/pages/Stats/Stats.js | 13 ++++++++++++- webapp/src/pages/Stats/Stats.test.js | 4 ++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/webapp/src/pages/Stats/Stats.js b/webapp/src/pages/Stats/Stats.js index cdb0c2cc..1ed03d73 100644 --- a/webapp/src/pages/Stats/Stats.js +++ b/webapp/src/pages/Stats/Stats.js @@ -11,6 +11,7 @@ const Stats = () => { const [gamemode, setGamemode] = useState("clasico"); const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(null); + const [fetched,setFetched] = useState(false); const fetchStats = () => { setIsLoading(true); @@ -28,7 +29,11 @@ const Stats = () => { }; useEffect(() => { - fetchStats(); // Eliminamos el retardo para la primera llamada + if(!fetched){ + fetchStats(); + setFetched(true); + } + }, [username, gamemode]); const handleUsernameChange = (event) => { @@ -41,6 +46,10 @@ const Stats = () => { fetchStats(); }; + const handleSearch = () => { + fetchStats(); + }; + const getModeName = () => { if(gamemode=="clasico"){ return "Clásico"; @@ -72,6 +81,7 @@ const Stats = () => { onChange={handleUsernameChange} data-testid="usernameInput" /> + Error: {error}

Por favor compruebe si los valores del formulario son correctos e @@ -95,6 +105,7 @@ const Stats = () => { onChange={handleUsernameChange} data-testid="usernameInput" /> +