mirror of https://github.com/sussy-code/smov.git
Fix some issues with init of turnstile hopefully
This commit is contained in:
parent
86a3c42887
commit
384cc43936
|
@ -9,7 +9,7 @@ import {
|
||||||
useInternalOverlayRouter,
|
useInternalOverlayRouter,
|
||||||
useRouterAnchorUpdate,
|
useRouterAnchorUpdate,
|
||||||
} from "@/hooks/useOverlayRouter";
|
} from "@/hooks/useOverlayRouter";
|
||||||
import { TurnstileProvider } from "@/stores/turnstile";
|
import { TurnstileProvider, getTurnstile } from "@/stores/turnstile";
|
||||||
|
|
||||||
export interface OverlayProps {
|
export interface OverlayProps {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -20,6 +20,7 @@ export interface OverlayProps {
|
||||||
function TurnstileInteractive() {
|
function TurnstileInteractive() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [show, setShow] = useState(false);
|
const [show, setShow] = useState(false);
|
||||||
|
getTurnstile();
|
||||||
|
|
||||||
// this may not rerender with different dom structure, must be exactly the same always
|
// this may not rerender with different dom structure, must be exactly the same always
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -81,6 +81,9 @@ export async function getTurnstileToken() {
|
||||||
const turnstile = getTurnstile();
|
const turnstile = getTurnstile();
|
||||||
try {
|
try {
|
||||||
// I hate turnstile
|
// I hate turnstile
|
||||||
|
if (turnstile.controls.isExpired()) {
|
||||||
|
turnstile.controls.reset();
|
||||||
|
}
|
||||||
(window as any).turnstile.execute(
|
(window as any).turnstile.execute(
|
||||||
document.querySelector(`#${turnstile.id}`),
|
document.querySelector(`#${turnstile.id}`),
|
||||||
{},
|
{},
|
||||||
|
|
Loading…
Reference in New Issue