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,
|
||||
useRouterAnchorUpdate,
|
||||
} from "@/hooks/useOverlayRouter";
|
||||
import { TurnstileProvider } from "@/stores/turnstile";
|
||||
import { TurnstileProvider, getTurnstile } from "@/stores/turnstile";
|
||||
|
||||
export interface OverlayProps {
|
||||
id: string;
|
||||
|
@ -20,6 +20,7 @@ export interface OverlayProps {
|
|||
function TurnstileInteractive() {
|
||||
const { t } = useTranslation();
|
||||
const [show, setShow] = useState(false);
|
||||
getTurnstile();
|
||||
|
||||
// this may not rerender with different dom structure, must be exactly the same always
|
||||
return (
|
||||
|
|
|
@ -81,6 +81,9 @@ export async function getTurnstileToken() {
|
|||
const turnstile = getTurnstile();
|
||||
try {
|
||||
// I hate turnstile
|
||||
if (turnstile.controls.isExpired()) {
|
||||
turnstile.controls.reset();
|
||||
}
|
||||
(window as any).turnstile.execute(
|
||||
document.querySelector(`#${turnstile.id}`),
|
||||
{},
|
||||
|
|
Loading…
Reference in New Issue