fix : date cannot be set in the future error
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user