fix : date cannot be set in the future error

This commit is contained in:
GuillaumeSD
2025-06-01 04:04:21 +02:00
parent 45a96448f7
commit 629fccf484

View File

@@ -15,12 +15,15 @@ export const getChessComUserRecentGames = async (
{ method: "GET", signal }
);
if (res.status >= 400) {
const data = await res.json();
if (
res.status >= 400 &&
data.message !== "Date cannot be set in the future"
) {
throw new Error("Error fetching games from Chess.com");
}
const data = await res.json();
const games: ChessComGame[] = data?.games ?? [];
if (games.length < 50) {