Spaces:
Build error
Build error
File size: 423 Bytes
c30d191 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import { collections } from "$lib/server/database";
import { authCondition } from "$lib/server/auth";
export async function GET({ locals }) {
if (locals.user?._id || locals.sessionId) {
const res = await collections.conversations
.find({
...authCondition(locals),
})
.toArray();
return Response.json(res);
} else {
return Response.json({ message: "Must have session cookie" }, { status: 401 });
}
}
|