Skip to content

tokenmgmt

useTurnstile

Composable to handle turnstile verification Returns an object with three refs and one function: - isVerified: a boolean indicating whether the turnstile verification was successful - isLoading: a boolean indicating whether a verification is currently in progress - errorMessage: a string containing an error message in case of verification failure - onTurnstileSuccess: a function to call when the turnstile verification is successful, which will send a request to the server to verify the token and update the isVerified ref accordingly

Returns:

  • object with the above properties

onTurnstileSuccess (async)

Nested in: useTurnstile

Attempts to verify the given turnstile token by sending a request to the verification server. Updates the isVerified, isLoading, and errorMessage refs based on the verification result.

Parameters:

  • token: - The turnstile token to verify.

Released under the MIT License.