Skip to content

Commit

Permalink
Arreglar errores de usuario
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasKetterer committed Oct 12, 2024
1 parent 5ee68e7 commit eaf3e09
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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 = [];
Expand All @@ -34,17 +34,17 @@ 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}`);
setWalletBalance(response.data.wallet);
} 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);
Expand All @@ -53,7 +53,7 @@ function App() {
} catch (error) {
console.error('Error fetching fixtures:', error);
}
}, []);
};

const generateLongUserId = () => {
const timestamp = Date.now();
Expand All @@ -62,7 +62,7 @@ function App() {
return `${timestamp}-${highPrecision}-${randomPart}`;
};

const createUser = useCallback(async () => {
const createUser = async () => {
try {
const encodedUserId = generateLongUserId();

Expand Down Expand Up @@ -99,7 +99,7 @@ function App() {
}
console.error('Error creating user:', error);
}
}, [user]);
};


const addMoneyToWallet = async () => {
Expand Down Expand Up @@ -180,7 +180,7 @@ function App() {
fetchFixtures();
fetchUser();
}
}, [isAuthenticated, createUser, fetchFixtures, fetchUser]);
}, [isAuthenticated]);

useEffect(() => {
const applyFilters = () => {
Expand Down

0 comments on commit eaf3e09

Please sign in to comment.