File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121 let mounted = $state <boolean >(false );
2222 let widgetId = $state <string | undefined >();
2323
24- function resetWidget() {
25- if (window .turnstile && widgetId ) window .turnstile .reset (widgetId );
26- }
27- function handleExpired() {
28- response = null ;
29- // Reset the widget after 5 seconds to prevent the user from spamming the button
30- setTimeout (resetWidget , 5000 );
31- }
32- function handleTimeout() {
33- response = null ;
34- // Reset the widget after 5 seconds to prevent the user from spamming the button
35- setTimeout (resetWidget , 5000 );
36- }
37- function handleError() {
38- toast .warning (' Turnstile encountered an error' );
24+ function invalidateResponse() {
3925 response = null ;
4026 }
4127
5036 cData ,
5137 theme ,
5238 callback : (token ) => (response = token ),
53- ' expired-callback' : handleExpired ,
54- ' timeout-callback' : handleTimeout ,
55- ' error-callback' : handleError ,
39+ ' expired-callback' : invalidateResponse ,
40+ ' timeout-callback' : invalidateResponse ,
41+ ' error-callback' : invalidateResponse ,
5642 });
5743 }
5844
You can’t perform that action at this time.
0 commit comments