aboutsummaryrefslogtreecommitdiff
path: root/src/components/Scoreboard/Scoreboard.js
blob: 5545d190aa4a9876fdae539a17816f19a33eeadd (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
import React, {useEffect, useState} from 'react';

import { Container } 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">
      {solutions.map(solution => (<Solution solution={solution}/>))}
    </Container>
  );
};

export default Scoreboard;