This commit is contained in:
hailin 2025-04-21 11:23:24 +08:00
parent 413493200a
commit 43b441fd12
1 changed files with 8 additions and 1 deletions

View File

@ -134,6 +134,14 @@ export const ProfileSettings: FC<ProfileSettingsProps> = ({}) => {
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<ProfileSettingsProps> = ({}) => {
locale = segment
}
// const loginPath = locale === defaultLocale ? "/login" : `/${locale}/login`
const homePath = locale === defaultLocale ? "/" : `/${locale}`
router.push(homePath)