diff options
| author | Adam Soltys <[email protected]> | 2026-03-03 14:39:08 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-03-03 14:39:08 -0800 |
| commit | 6624b19b1d954dc69afbf1a9f6072e791771aff5 (patch) | |
| tree | b558d6673be563ee1038abf9c55b7b509097f1b7 /src/routes/+layout.server.ts | |
| parent | 41c6636efee032a29c380ef0ee7ef73a99f64cd5 (diff) | |
| download | coinos-ui-6624b19b1d954dc69afbf1a9f6072e791771aff5.tar.gz coinos-ui-6624b19b1d954dc69afbf1a9f6072e791771aff5.zip | |
static page loads
Diffstat (limited to 'src/routes/+layout.server.ts')
| -rw-r--r-- | src/routes/+layout.server.ts | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts index 9f0c584d..61c46ea6 100644 --- a/src/routes/+layout.server.ts +++ b/src/routes/+layout.server.ts @@ -1,36 +1,10 @@ import { defaultLocale, loadTranslations, locales } from "$lib/translations/index"; -import { auth, get, isInvalidTokenError, sleep } from "$lib/utils"; -import { redirect } from "@sveltejs/kit"; export const load = async ({ cookies, request, url }) => { const { pathname } = url; - let user; - const token = cookies.get("token"); - if (token) { - try { - user = await get("/me", auth(cookies)); - } catch (e) { - const { message } = e as Error; - if (message.startsWith("Rate")) { - await sleep(3000); - try { - user = await get("/me", auth(cookies)); - } catch (retryError) { - if (isInvalidTokenError(retryError) && pathname !== "/logout") { - redirect(307, "/logout"); - } - throw retryError; - } - } else if (isInvalidTokenError(e) && pathname !== "/logout") { - redirect(307, "/logout"); - } else { - throw e; - } - } - } // Try to get the locale from cookie - let locale = user?.language || (cookies.get("lang") || "").toLowerCase(); + let locale = (cookies.get("lang") || "").toLowerCase(); // Get user preferred locale if (!locale) { @@ -55,6 +29,5 @@ export const load = async ({ cookies, request, url }) => { theme, pathname, i18n: { locale, route: pathname }, - user, }; }; |
