diff options
| author | Adam Soltys <[email protected]> | 2023-12-06 20:33:45 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-12-06 20:33:45 -0800 |
| commit | 6b3ff247e4125941a611369ed9bb74a2ffca57d8 (patch) | |
| tree | 91da939350398188834e5e002bc78011a2a8e5bf /src/routes/+layout.server.js | |
| parent | bb59ac3e4e7fcbf7f8a48820eab0ee21558183fc (diff) | |
| parent | d69c34cf389639eac82d24d1f1b02f038ef42399 (diff) | |
| download | coinos-ui-6b3ff247e4125941a611369ed9bb74a2ffca57d8.tar.gz coinos-ui-6b3ff247e4125941a611369ed9bb74a2ffca57d8.zip | |
Merge branch 'master' into swapee
Diffstat (limited to 'src/routes/+layout.server.js')
| -rw-r--r-- | src/routes/+layout.server.js | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/routes/+layout.server.js b/src/routes/+layout.server.js index 60a2f6c6..5273d372 100644 --- a/src/routes/+layout.server.js +++ b/src/routes/+layout.server.js @@ -1,17 +1,17 @@ import { auth, get } from "$lib/utils"; -import { loadTranslations, locale } from '$lib/translations'; +import { loadTranslations, locale } from "$lib/translations"; export const load = async ({ cookies, url }) => { - let user; - let token = cookies.get('token'); - if (token) { - try { - user = await get('/me', auth(cookies)); - } catch (e) {} - } + let user; + let token = cookies.get("token"); + if (token) { + try { + user = await get("/me", auth(cookies)); + } catch (e) {} + } - const { host, pathname } = url; - const defaultLocale = user?.language || 'en'; // get from cookie, user session, ... - const initLocale = locale.get() || defaultLocale; // set default if no locale already set - await loadTranslations(initLocale, pathname); // keep this just before the `return` - return { host, pathname }; + const { host, pathname } = url; + const defaultLocale = user?.language || "en"; // get from cookie, user session, ... + const initLocale = locale.get() || defaultLocale; // set default if no locale already set + await loadTranslations(initLocale, pathname); // keep this just before the `return` + return { host, pathname }; }; |
