Merge branch 'web3' of https://github.com/calendso/calendso into web3

extract api response to const
pull/1439/head
Yuval Drori 2021-12-30 19:09:22 +01:00
commit 9ed4295b28
1 changed files with 3 additions and 3 deletions

View File

@ -7,7 +7,7 @@ import prisma from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession({ req: req });
if (!session) {
if (!session?.user?.id) {
res.status(401).json({ message: "Not authenticated" });
return;
}
@ -34,7 +34,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const user = await prisma.user.findUnique({
where: {
id: session?.user?.id,
id: session.user.id,
},
select: {
id: true,
@ -83,7 +83,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
// backwards compatibility, TMP:
const typesRaw = await prisma.eventType.findMany({
where: {
userId: session?.user?.id,
userId: session.user.id,
},
select: eventTypeSelect,
});