mirror of
https://github.com/ArthurDanjou/arthome.git
synced 2026-01-14 12:14:33 +01:00
Add auth
This commit is contained in:
10
server/api/authorized.post.ts
Normal file
10
server/api/authorized.post.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
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
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
export default defineEventHandler(() => {
|
||||
return { hello: 'API' }
|
||||
})
|
||||
Reference in New Issue
Block a user