This commit is contained in:
parent
4dfdf0d592
commit
a220ff8f8f
|
|
@ -3,14 +3,19 @@
|
|||
|
||||
import { useEffect } from "react"
|
||||
import { useRouter } from "next/navigation"
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
export default function ClearCookiesThenRedirect({ params }: { params: { locale: string } }) {
|
||||
|
||||
const router = useRouter()
|
||||
const { t } = useTranslation()
|
||||
|
||||
useEffect(() => {
|
||||
// 🔥 手动清除浏览器端 cookie(服务端清除不够)
|
||||
document.cookie = "sb-67-auth-token=; path=/; max-age=0"
|
||||
document.cookie = "sb-67-auth-token-code-verifier=; path=/; max-age=0"
|
||||
document.cookie = "_ga=; path=/; max-age=0"
|
||||
|
||||
// ✅ 仍然调用服务端 API 处理 HttpOnly cookie(比如 Supabase 设置的)
|
||||
fetch("/api/clearcookies", { method: "POST" }).finally(() => {
|
||||
router.replace(`/${params.locale}/login?message=sessionExpired&cleaned=true`)
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue