Skip to content

Commit

Permalink
refactor: Update leaderboard API endpoint to include all team details…
Browse files Browse the repository at this point in the history
… and sort high to low
  • Loading branch information
AyoItsYas committed May 22, 2024
1 parent 3b467bf commit e5848b4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/app/(client)/(pages)/leaderboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function Page() {
async function fetchData() {
try {
const response = await axios.get(
"https://techiesleuths-backend-webapp-prod.azurewebsites.net/api/v1/score/all-teams?all_details=true&high_to_low=true"
"https://techiesleuths-backend-webapp-prod.azurewebsites.net/api/v1/score/all-teams?all_details=true&high_to_low=true",
);

if (response.status !== 200) {
Expand All @@ -36,7 +36,7 @@ export default function Page() {
name: `${index + 1}. ${item.team.team_name}`,
value: item.score.score,
href: item.team.team_profile_img_url,
})
}),
);

setData(transformedData);
Expand All @@ -50,6 +50,14 @@ export default function Page() {
fetchData();
}, []);

useEffect(() => {
const interval = setInterval(() => {
window.location.reload();
}, 30000);

return () => clearInterval(interval);
}, []);

const style = {
boxShadowLittle: "3px 3px #000",
boxShadowLarge: "8px 8px #000",
Expand Down

0 comments on commit e5848b4

Please sign in to comment.