diff --git a/components/utility/profile-settings.tsx b/components/utility/profile-settings.tsx index 373be95..0e7d217 100644 --- a/components/utility/profile-settings.tsx +++ b/components/utility/profile-settings.tsx @@ -134,6 +134,14 @@ export const ProfileSettings: FC = ({}) => { const handleSignOut = async () => { await supabase.auth.signOut() + // ✅ 清除 localStorage 中的语言偏好 + if (typeof window !== "undefined") { + localStorage.removeItem("preferred-language") + } + + // ✅ 清除 Cookie 中的语言偏好(设置 max-age=0 立即过期) + document.cookie = "preferred-language=; path=/; max-age=0" + const pathSegments = pathname.split("/").filter(Boolean) const locales = i18nConfig.locales const defaultLocale = i18nConfig.defaultLocale @@ -146,7 +154,6 @@ export const ProfileSettings: FC = ({}) => { locale = segment } - // const loginPath = locale === defaultLocale ? "/login" : `/${locale}/login` const homePath = locale === defaultLocale ? "/" : `/${locale}` router.push(homePath)