Compare commits
2 Commits
558adbb84f
...
d85f08fb7a
| Author | SHA1 | Date |
|---|---|---|
|
|
d85f08fb7a | |
|
|
3d27d58abe |
|
|
@ -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
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 的语言
|
||||||
|
|
|
||||||
|
|
@ -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.')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue