Skip to content

Commit

Permalink
fix: redirect issue
Browse files Browse the repository at this point in the history
  • Loading branch information
bbtgnn committed Feb 12, 2024
1 parent 32d038a commit 0ce8e69
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/routes/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ export const ssr = false;

//

import { r, type Locale } from '$lib/i18n';
import { redirect } from '@sveltejs/kit';
// import { r, type Locale } from '$lib/i18n';
// import { redirect } from '@sveltejs/kit';
import { Device } from '@capacitor/device';
import { getLanguagePreference, setLanguagePreference } from '$lib/preferences/lang';

Expand All @@ -14,14 +14,14 @@ const setInitialLanguage = async () => {
}
};

const getLang = async () => {
const lang = await getLanguagePreference();
if (lang && ['it', 'en'].includes(lang)) return lang as Locale;
return 'en' as Locale;
};
// const getLang = async () => {
// const lang = await getLanguagePreference();
// if (lang && ['it', 'en'].includes(lang)) return lang as Locale;
// return 'en' as Locale;
// };

export const load = async () => {
await setInitialLanguage();
const lang = await getLang();
redirect(303, r('/', lang));
// const lang = await getLang();
// redirect(303, r('/', lang));
};

0 comments on commit 0ce8e69

Please sign in to comment.