Files
dj_nuxt/server/api/verify.post.ts
Beyhan Oğur 5ad37467cf first commit
2026-04-26 22:06:07 +03:00

24 lines
584 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
export default defineEventHandler(async (event) => {
const body = await readBody(event)
const token = body.token
if (!token) {
throw createError({
statusCode: 422,
statusMessage: 'Token not provided.',
})
}
// NuxtTurnstile modülünün sağladığı sunucu fonksiyonu
const validation = await verifyTurnstileToken(token)
if (!validation.success) {
throw createError({
statusCode: 400,
statusMessage: 'Captcha validation failed.',
})
}
return { success: true }
})