Skip to content

Commit 140a680

Browse files
committed
add retry & retryInterval
1 parent 6db8848 commit 140a680

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

HISTORY.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
### Changed
10+
### Added
1111

12-
- Added support for the new `onTimeout` callback
12+
- Support for the new `onTimeout` callback
13+
- `autoResetOnExpire` for automatically resetting the Turnstile widget once the token expires
14+
- `retry` & `retryInterval`
1315

1416
## [1.0.5] - 2022-10-22
1517

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Turnstile takes the following arguments:
4141
| tabIndex | number | - |
4242
| responseField | boolean | controls generation of `<input />` element |
4343
| responseFieldName | string | changes the name of `<input />` element |
44+
| retry | string | one of "auto", "never" |
45+
| retryInterval | number | interval of retries in ms |
4446
| autoResetOnExpire | boolean | automatically reset the widget when the token expires |
4547
| id | string | id of the div |
4648
| className | string | passed to the div |

src/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ export default function Turnstile({
5353
tabIndex,
5454
responseField,
5555
responseFieldName,
56+
retry,
57+
retryInterval,
5658
autoResetOnExpire,
5759
onVerify,
5860
onLoad,
@@ -94,6 +96,8 @@ export default function Turnstile({
9496
"timeout-callback": () => inplaceState.onTimeout?.(),
9597
"response-field": responseField,
9698
"response-field-name": responseFieldName,
99+
retry,
100+
"retry-interval": retryInterval,
97101
};
98102

99103
widgetId = window.turnstile.render(ref.current, turnstileOptions);
@@ -112,6 +116,8 @@ export default function Turnstile({
112116
tabIndex,
113117
responseField,
114118
responseFieldName,
119+
retry,
120+
retryInterval,
115121
autoResetOnExpire,
116122
]);
117123
useEffect(() => {
@@ -133,6 +139,8 @@ interface TurnstileProps extends TurnstileCallbacks {
133139
tabIndex?: number;
134140
responseField?: boolean;
135141
responseFieldName?: string;
142+
retry?: "auto" | "never";
143+
retryInterval?: number;
136144
autoResetOnExpire?: boolean;
137145

138146
id?: string;

0 commit comments

Comments
 (0)