From eaf3e094636ef7c53f2a97de30b002a28102d9a8 Mon Sep 17 00:00:00 2001 From: TomasKetterer Date: Sat, 12 Oct 2024 16:36:40 -0300 Subject: [PATCH] Arreglar errores de usuario --- src/App.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/App.js b/src/App.js index 94fcd3a..efc1f84 100644 --- a/src/App.js +++ b/src/App.js @@ -1,5 +1,5 @@ import './App.css'; -import React, { useState, useEffect, useCallback } from 'react'; +import React, { useState, useEffect } from 'react'; import axios from 'axios'; import { useAuth0 } from '@auth0/auth0-react'; @@ -18,7 +18,7 @@ function App() { const [result, setResult] = useState('home'); const [quantity, setQuantity] = useState(1); const [showAddMoneyModal, setShowAddMoneyModal] = useState(false); - const fixturesPerPage = 24; + const fixturesPerPage = 9; const removeDuplicateFixtures = (fixtures) => { const uniqueFixtures = []; @@ -34,7 +34,7 @@ function App() { return uniqueFixtures; }; - const fetchUser = useCallback(async () => { + const fetchUser = async () => { try { const encodedUserId = localStorage.getItem('userId'); const response = await axios.get(`https://api.nodecraft.me/users/${encodedUserId}`); @@ -42,9 +42,9 @@ function App() { } catch (error) { console.error('Error fetching wallet balance:', error); } - }, []); + }; - const fetchFixtures = useCallback(async () => { + const fetchFixtures = async () => { try { const response = await axios.get('https://api.nodecraft.me/fixtures'); const uniqueFixtures = removeDuplicateFixtures(response.data.data); @@ -53,7 +53,7 @@ function App() { } catch (error) { console.error('Error fetching fixtures:', error); } - }, []); + }; const generateLongUserId = () => { const timestamp = Date.now(); @@ -62,7 +62,7 @@ function App() { return `${timestamp}-${highPrecision}-${randomPart}`; }; - const createUser = useCallback(async () => { + const createUser = async () => { try { const encodedUserId = generateLongUserId(); @@ -99,7 +99,7 @@ function App() { } console.error('Error creating user:', error); } - }, [user]); + }; const addMoneyToWallet = async () => { @@ -180,7 +180,7 @@ function App() { fetchFixtures(); fetchUser(); } - }, [isAuthenticated, createUser, fetchFixtures, fetchUser]); + }, [isAuthenticated]); useEffect(() => { const applyFilters = () => {