Prevented the bug where the application is crashing

This commit is contained in:
Tiago Ribeiro
2024-03-24 02:32:12 +00:00
parent 29b2c8b3b8
commit 22f2b43692
8 changed files with 86 additions and 68 deletions

View File

@@ -18,6 +18,7 @@ async function GET(req: NextApiRequest, res: NextApiResponse) {
const {id} = req.query;
const snapshot = await getDoc(doc(db, "stats", id as string));
if (!snapshot.exists()) return res.status(404).json({id: snapshot.id});
res.status(200).json({...snapshot.data(), id: snapshot.id});
}
}