-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update deprecated types #30
Conversation
Added a function export 'useTurnstile' that exposes the 'reset' method of the global turnstile object.
Return entire turnstile object rather than just the reset() method.
Changed deprecated "TurnstileOptions"to "RenderParameters". Removed "invisible" option from "size" option. May cause breaking changes.
Add "size" to props
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Programmatic access example: | ||
const turnstile = useTurnstile(); | ||
|
||
const result = await fetch('/path/to/some/api'); | ||
if (!result.ok) { | ||
throw new Error(`Request failed with code ${result.status}`); | ||
turnstile.reset(); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nonsensical addition, you are using a hook outside of a component.
The example on main also already covers this.
export function useTurnstile() { | ||
return global.turnstile; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function already exists with a proper component reload if you werent 36 commits behind.
Changed deprecated "TurnstileOptions"to "RenderParameters". Removed "invisible" option from "size" option. May cause breaking changes.