Compare commits

...

2 Commits

Author SHA1 Message Date
hailin d85f08fb7a . 2025-04-22 13:03:26 +08:00
hailin 3d27d58abe . 2025-04-22 13:01:27 +08:00
3 changed files with 3 additions and 7 deletions

View File

@ -48,7 +48,7 @@ export default async function Login({
) )
const session = (await supabase.auth.getSession()).data.session const session = (await supabase.auth.getSession()).data.session
console.log("[login page]Login session==>:", session) console.log("[login page]Login session:", session)
if (session) { if (session) {
const { data: homeWorkspace, error } = await supabase const { data: homeWorkspace, error } = await supabase
@ -93,8 +93,9 @@ export default async function Login({
.single() .single()
if (!homeWorkspace) { if (!homeWorkspace) {
const fallbackMessage = t("login.unexpectedError")
throw new Error( throw new Error(
homeWorkspaceError?.message || t("login.unexpectedError") homeWorkspaceError?.message || fallbackMessage
) )
} }

View File

@ -26,8 +26,6 @@ export function LanguageSwitcher() {
const isLocaleInPath = i18nConfig.locales.includes(currentLocale as any) const isLocaleInPath = i18nConfig.locales.includes(currentLocale as any)
console.log('[LanguageSwitcher]=>i18nConfig.locales default=', currentLocale)
} }
else{ else{
console.log('[LanguageSwitcher] language switcher cannt running in server.') console.log('[LanguageSwitcher] language switcher cannt running in server.')
@ -41,11 +39,9 @@ export function LanguageSwitcher() {
document.cookie = `preferred-language=${newLocale}; path=/; max-age=31536000` document.cookie = `preferred-language=${newLocale}; path=/; max-age=31536000`
// 同时更新 localStorage // 同时更新 localStorage
console.log('[LanguageSwitcher] Write to localStorage newLocale value:', newLocale)
localStorage.setItem('preferred-language', newLocale) localStorage.setItem('preferred-language', newLocale)
// 验证 cookie 是否成功写入 // 验证 cookie 是否成功写入
console.log('[LanguageSwitcher] Read back to check if cookie value saved?', document.cookie)
const cookieValue = document.cookie const cookieValue = document.cookie
// 更新 i18n 的语言 // 更新 i18n 的语言

View File

@ -18,7 +18,6 @@ export default function HomeRedirector() {
const currentPath = window.location.pathname const currentPath = window.location.pathname
console.log('[HomeRedirector] localStorage preferred:', preferred) console.log('[HomeRedirector] localStorage preferred:', preferred)
console.log('[HomeRedirector] currentPath:', currentPath)
if (!preferred || !isValidLocale(preferred)) { if (!preferred || !isValidLocale(preferred)) {
console.log('[HomeRedirector] No valid preferred language found.') console.log('[HomeRedirector] No valid preferred language found.')