Skip to content

Commit

Permalink
record buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfdzs committed Mar 11, 2024
1 parent fce8d4f commit cedaff5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 15 additions & 3 deletions webapp/src/components/Record.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -23,10 +27,12 @@ const Record = () => {
const { games: userGames } = response.data;
setRecord(userGames);



}

const showHome = () => {
navigate("/home", {state: {username}});
};

/*const llamaHistorial = () => {
getHistorialForLoggedUser();
}*/
Expand Down Expand Up @@ -56,6 +62,12 @@ const Record = () => {
</ListItem>
))}
</List>
<Button
variant="contained"
style={{ width: '100%', fontWeight: 'bold' }}
onClick={showHome}>
Home
</Button>
</Container>
);
};
Expand Down
2 changes: 2 additions & 0 deletions webapp/src/components/Record.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ describe('Record component', () => {
});

it('should render succesfully', async () => {
mockAxios.onPost('http://localhost:8000/getHistorial').reply(200, {games: []});

render(
<Router>
<Record />
Expand Down

0 comments on commit cedaff5

Please sign in to comment.