diff --git a/webapp/src/components/Record.js b/webapp/src/components/Record.js index cc31630..8f44226 100644 --- a/webapp/src/components/Record.js +++ b/webapp/src/components/Record.js @@ -1,11 +1,15 @@ // src/components/Record.js import React, { useState, useEffect } from 'react'; import axios from 'axios'; -import { Container, Typography, List, ListItem, ListItemAvatar, Avatar, ListItemText } from '@mui/material'; +import { Container, Typography, List, ListItem, ListItemText, Button } from '@mui/material'; import { useLocation } from "react-router-dom"; +import {useNavigate} from "react-router-dom"; + const Record = () => { + const navigate = useNavigate(); + const apiEndpoint = process.env.REACT_APP_API_ENDPOINT || 'http://localhost:8000'; //accedo al usuario logeado @@ -23,10 +27,12 @@ const Record = () => { const { games: userGames } = response.data; setRecord(userGames); - - } + const showHome = () => { + navigate("/home", {state: {username}}); + }; + /*const llamaHistorial = () => { getHistorialForLoggedUser(); }*/ @@ -56,6 +62,12 @@ const Record = () => { ))} + ); }; diff --git a/webapp/src/components/Record.test.js b/webapp/src/components/Record.test.js index c7231ec..3b39e98 100644 --- a/webapp/src/components/Record.test.js +++ b/webapp/src/components/Record.test.js @@ -13,6 +13,8 @@ describe('Record component', () => { }); it('should render succesfully', async () => { + mockAxios.onPost('http://localhost:8000/getHistorial').reply(200, {games: []}); + render(