Updated more of the page
This commit is contained in:
@@ -24,7 +24,7 @@ async function get(req: NextApiRequest, res: NextApiResponse) {
|
||||
const {user} = req.query as {user?: string};
|
||||
|
||||
const q = user ? {user: user} : {};
|
||||
const sessions = await db.collection("sessions").find<Session>(q).toArray();
|
||||
const sessions = await db.collection("sessions").find<Session>(q).limit(10).toArray();
|
||||
|
||||
res.status(200).json(
|
||||
sessions.filter((x) => {
|
||||
@@ -41,12 +41,8 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
||||
return;
|
||||
}
|
||||
const session = req.body;
|
||||
|
||||
await db.collection("sessions").updateOne(
|
||||
{ id: session.id},
|
||||
{ $set: session },
|
||||
{ upsert: true }
|
||||
);
|
||||
|
||||
await db.collection("sessions").updateOne({id: session.id}, {$set: session}, {upsert: true});
|
||||
|
||||
res.status(200).json({ok: true});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user