aboutsummaryrefslogtreecommitdiff
path: root/src/components/Scoreboard/Scoreboard.js
blob: 1235f9a3e3a1fe4835ea71e523e6347840923fdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import React, { useEffect, useState } from 'react';

import { Container, Typography } from "@material-ui/core";

import { get } from "../../requests";
import Solution from "./Solution";


const Scoreboard = () => {
  const [solutions, setSolutions] = useState([]);

  const updateSolutions = async () => {
    const response = await get('solutions/');
    await setSolutions(response.data);
  };

  useEffect(() => {
    updateSolutions();
  }, []);


  return (
    <Container maxWidth="sm">
      <Typography variant="h3" style={{textAlign: 'center'}}>Scoreboard</Typography>
      {solutions.map(solution => (<Solution solution={solution}/>))}
    </Container>
  );
};

export default Scoreboard;