Files
arthome/server/api/authorized.post.ts
2024-08-22 18:20:29 +02:00

11 lines
318 B
TypeScript

import { useValidatedBody, z } from 'h3-zod'
export default defineEventHandler(async (event) => {
const users = await useDB().select().from(tables.users).all()
const { email } = await useValidatedBody(event, {
email: z.string(),
})
const user = users.find(user => user.email === email)
return !!user
})