This commit is contained in:
parent
413493200a
commit
43b441fd12
|
|
@ -134,6 +134,14 @@ export const ProfileSettings: FC<ProfileSettingsProps> = ({}) => {
|
||||||
const handleSignOut = async () => {
|
const handleSignOut = async () => {
|
||||||
await supabase.auth.signOut()
|
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 pathSegments = pathname.split("/").filter(Boolean)
|
||||||
const locales = i18nConfig.locales
|
const locales = i18nConfig.locales
|
||||||
const defaultLocale = i18nConfig.defaultLocale
|
const defaultLocale = i18nConfig.defaultLocale
|
||||||
|
|
@ -146,7 +154,6 @@ export const ProfileSettings: FC<ProfileSettingsProps> = ({}) => {
|
||||||
locale = segment
|
locale = segment
|
||||||
}
|
}
|
||||||
|
|
||||||
// const loginPath = locale === defaultLocale ? "/login" : `/${locale}/login`
|
|
||||||
const homePath = locale === defaultLocale ? "/" : `/${locale}`
|
const homePath = locale === defaultLocale ? "/" : `/${locale}`
|
||||||
|
|
||||||
router.push(homePath)
|
router.push(homePath)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue