This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
export const prerender = false; | |
export const POST = async ({ request }) => { | |
try { | |
const requestData = await request.json(); | |
const google_access_token = requestData.google_access_token; | |
const SECRET_KEY = 'yoursecretkey'; | |
// Make a POST request to Google reCAPTCHA verification API | |
const response = await axios.post( 'https://www.google.com/recaptcha/api/siteverify',null, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function loadScript(src) { | |
return new Promise((resolve, reject) => { | |
const script = document.createElement('script') | |
script.setAttribute("src", src) | |
document.body.appendChild(script) | |
script.onload = resolve | |
script.onerror = reject | |
}) | |
} |