ldespe
ldespe
CDCloudflare Developers
Created by ldespe on 9/4/2024 in #general-help
Problem Recaptcha NuxtJs/Turnstile
I have tried to use a Turnstile with cloudfare on my portfolio with my contact form. I use NuxtJs (no Nextjs) and I have a warning on my console which says : "he resource was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate as value and it is preloaded intentionally. " My validateTurnstile.ts :
// server/api/validateTurnstile.ts

export default defineEventHandler(async (event) => {
const { token } = await readBody(event)

if (!token) {

throw createError({
statusCode: 422,
statusMessage: 'Token not provided.',
})
}
else{
console.log(token)
}

return await verifyTurnstileToken(token)
})
// server/api/validateTurnstile.ts

export default defineEventHandler(async (event) => {
const { token } = await readBody(event)

if (!token) {

throw createError({
statusCode: 422,
statusMessage: 'Token not provided.',
})
}
else{
console.log(token)
}

return await verifyTurnstileToken(token)
})
12 replies