mirror of
https://github.com/System-End/site.git
synced 2026-04-19 22:05:11 +00:00
feat: api request
This commit is contained in:
parent
cb34a5d9e8
commit
7781eb29e3
2 changed files with 5 additions and 6 deletions
|
|
@ -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]}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue