exclude ended games from public api

This commit is contained in:
Nathaniel Tampus
2023-03-06 18:43:50 +08:00
parent 19880c0818
commit 440e8cd540

View File

@@ -5,7 +5,7 @@ import { nanoid } from "nanoid";
export const getActivePublicGames = async (req: Request, res: Response) => {
try {
res.status(200).json(activeGames.filter((g) => !g.unlisted));
res.status(200).json(activeGames.filter((g) => !g.unlisted && !g.winner));
} catch (err: unknown) {
console.log(err);
res.status(500).end();