feat: api request

This commit is contained in:
GalaxyGamingBoy 2024-03-20 16:49:22 +00:00
parent cb34a5d9e8
commit 7781eb29e3
2 changed files with 5 additions and 6 deletions

View file

@ -159,7 +159,7 @@ function Game({ game, gameImage, gameImage1, ...props }) {
mb: 1
}}
>
<RelativeTime value={game['added on']} titleFormat="YYYY-MM-DD" />
<RelativeTime value={game['addedOn']} titleFormat="YYYY-MM-DD" />
</Text>
</Box>
</Box>
@ -257,7 +257,7 @@ export default function Sprig({ stars, game, gameImage, gameImage1 }) {
>
<Game
game={game[0]}
// gameImage={gameImage}
// gameImage={gameImage}
/>
<Game
game={game[1]}

View file

@ -1,11 +1,10 @@
export async function getGames() {
let games = await fetch(
'https://raw.githubusercontent.com/hackclub/sprig/main/games/metadata.json'
'https://sprig.hackclub.com/api/gallery?new'
).then(res => res.json())
games = games
.sort((a, b) => new Date(b.addedOn) - new Date(a.addedOn))
.slice(-4)
games.length = 4
return games
}