aboutsummaryrefslogtreecommitdiff
path: root/src/components/Scoreboard/Scoreboard.js
diff options
context:
space:
mode:
authorEug-VS <eug-vs@keemail.me>2020-01-02 17:20:23 +0300
committerEug-VS <eug-vs@keemail.me>2020-01-02 17:20:23 +0300
commit7c4e13d11bc2fc5b0f03efc959dd551a30565e8a (patch)
tree897f94f10f6bf2289b191bc89679e7c18ef14424 /src/components/Scoreboard/Scoreboard.js
parent88475b18f12e16fe32130a9e52ff6fe4297f5ba3 (diff)
downloadchrono-cube-ui-7c4e13d11bc2fc5b0f03efc959dd551a30565e8a.tar.gz
Create Scoreboard component & integrate with API
Diffstat (limited to 'src/components/Scoreboard/Scoreboard.js')
-rw-r--r--src/components/Scoreboard/Scoreboard.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/components/Scoreboard/Scoreboard.js b/src/components/Scoreboard/Scoreboard.js
new file mode 100644
index 0000000..1ebca90
--- /dev/null
+++ b/src/components/Scoreboard/Scoreboard.js
@@ -0,0 +1,28 @@
+import React, {useEffect, useState} from 'react';
+
+
+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 (
+ <div>
+ { solutions.map(solution => <Solution solution={solution}/>) }
+ </div>
+ );
+};
+
+export default Scoreboard; \ No newline at end of file