web/turnstile: use own callback for refreshing the widget
or at least try to, idk man, im so tired of cf turnstile
This commit is contained in:
@@ -35,7 +35,7 @@ export const requestSession = async () => {
|
||||
}
|
||||
});
|
||||
|
||||
turnstile.update();
|
||||
turnstile.reset();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ const getResponse = () => {
|
||||
return null;
|
||||
}
|
||||
|
||||
const update = () => {
|
||||
const reset = () => {
|
||||
const turnstileElement = document.getElementById("turnstile-widget");
|
||||
|
||||
if (turnstileElement) {
|
||||
@@ -21,21 +21,7 @@ const update = () => {
|
||||
return null;
|
||||
}
|
||||
|
||||
const refreshIfExpired = () => {
|
||||
const turnstileElement = document.getElementById("turnstile-widget");
|
||||
|
||||
if (turnstileElement) {
|
||||
const isExpired = window?.turnstile?.isExpired(turnstileElement);
|
||||
if (isExpired) {
|
||||
console.log("expired, refreshing the turnstile widget rn");
|
||||
return update();
|
||||
}
|
||||
console.log("turnstile not expired, nothing to do");
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
getResponse,
|
||||
update,
|
||||
refreshIfExpired,
|
||||
reset,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user