web/turnstile: refresh turnstile if it expires in background

also renamed `turnstileLoaded` to `turnstileSolved` for more clarity
This commit is contained in:
wukko
2024-11-18 21:05:47 +06:00
parent e09e098b27
commit b38cb77952
5 changed files with 31 additions and 17 deletions

View File

@@ -5,7 +5,7 @@ import lazySettingGetter from "$lib/settings/lazy-get";
import { getSession } from "$lib/api/session";
import { currentApiURL } from "$lib/api/api-url";
import { turnstileLoaded } from "$lib/state/turnstile";
import { turnstileSolved } from "$lib/state/turnstile";
import { cachedInfo, getServerInfo } from "$lib/api/server-info";
import type { Optional } from "$lib/types/generic";
@@ -49,7 +49,7 @@ const request = async (url: string) => {
} as CobaltErrorResponse;
}
if (getCachedInfo?.info?.cobalt?.turnstileSitekey && !get(turnstileLoaded)) {
if (getCachedInfo?.info?.cobalt?.turnstileSitekey && !get(turnstileSolved)) {
return {
status: "error",
error: {