aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEug-VS <eug-vs@keemail.me>2020-01-12 18:10:01 +0300
committerEug-VS <eug-vs@keemail.me>2020-01-12 18:10:01 +0300
commit364c16c467b5257980337a06497647ebc13e4c35 (patch)
treec4b8fb31a112ef3fe38b6f02a17d75d722ae3dea
parentc2d7aa43ab54726b4741bc426d63093ef6392a91 (diff)
parent23a5631531861ac76d532c0d9d2b19dd1862f739 (diff)
downloadchrono-cube-ui-364c16c467b5257980337a06497647ebc13e4c35.tar.gz
Merge branch 'master' into contribute
-rw-r--r--src/components/SolutionCard/SolutionCard.js5
-rw-r--r--src/pages/Scoreboard/Scoreboard.js8
2 files changed, 6 insertions, 7 deletions
diff --git a/src/components/SolutionCard/SolutionCard.js b/src/components/SolutionCard/SolutionCard.js
index 7cca74c..1fff873 100644
--- a/src/components/SolutionCard/SolutionCard.js
+++ b/src/components/SolutionCard/SolutionCard.js
@@ -54,9 +54,10 @@ const SolutionCard = ({ data, removeThisCard }) => {
};
const handleDelete = () => {
- del(`solutions/${data.id}/`);
+ del(`solutions/${data.id}/`).then(() => {
+ removeThisCard(data.id);
+ });
handleClose();
- removeThisCard(data.id);
};
return (
diff --git a/src/pages/Scoreboard/Scoreboard.js b/src/pages/Scoreboard/Scoreboard.js
index 61275c1..29d26c8 100644
--- a/src/pages/Scoreboard/Scoreboard.js
+++ b/src/pages/Scoreboard/Scoreboard.js
@@ -28,18 +28,16 @@ const Scoreboard = () => {
const updateSolutions = () => {
get('scoreboard/').then(response => {
- setTimeout(() => {
setSolutions(response.data);
- }, 300);
});
};
- const removeSolution = (id) => {
- setSolutions(solutions.filter((solution => solution.id !== id)));
+ const removeSolution = id => {
+ updateSolutions();
};
useEffect(() => {
- updateSolutions();
+ setTimeout(updateSolutions, 300);
}, []);
const renderItem = ({ index, style }) => {