export const verifyRecaptcha = async (token: string): Promise<boolean> => {
  console.log('token', token);
  const response = await fetch(
    `https://www.google.com/recaptcha/api/siteverify?secret=${process.env.APP_RECAPTCHA_SECRET}&response=${token}`
  );
  const json = await response.json();
  console.log('json',json);
  if (json.success) {
    console.log('=> ReCaptcha verified');
    return true;
  }
  console.error('=> ReCaptcha verification failed', json);
  throw new Error(json['error-codes']);
};
