mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-27 11:01:56 +02:00
[web] Add recaptcha to add-email GitOrigin-RevId: 0540e0dbc3103dcaac87dd7fabeedbc5892c371c
14 lines
388 B
TypeScript
14 lines
388 B
TypeScript
import { LegacyRef, createRef } from 'react'
|
|
import ReCAPTCHA from 'react-google-recaptcha'
|
|
|
|
export const useRecaptcha = () => {
|
|
const ref: LegacyRef<ReCAPTCHA> = createRef<ReCAPTCHA>()
|
|
const getReCaptchaToken = async (): Promise<string | null> => {
|
|
if (!ref.current) {
|
|
return null
|
|
}
|
|
return await ref.current.executeAsync()
|
|
}
|
|
return { ref, getReCaptchaToken }
|
|
}
|