diff --git a/components/home/lovart-home.tsx b/components/home/lovart-home.tsx index e0ffe602d..e76834fc1 100644 --- a/components/home/lovart-home.tsx +++ b/components/home/lovart-home.tsx @@ -23,7 +23,6 @@ import { Monitor, Palette, Plus, - Send, Settings, Sparkles, Star, @@ -562,6 +561,21 @@ export function LovartHome({ const canUseDingTalkLogin = Boolean(authSettingsData?.isDingTalkEnabled); const hasThirdPartyLoginOptions = canUseGoogleLogin || canUseDingTalkLogin; + const handleLogout = async () => { + try { + await fetch("/api/auth/logout", { method: "POST" }); + } catch (_error) {} + + try { + await signOut({ + callbackUrl: "/", + redirect: false, + }); + } catch (_error) {} + + window.location.replace("/"); + }; + useEffect(() => { if (selectedModelId) return; const defaultModelId = siteSettingsData?.canvasDefaultModelId || "auto"; @@ -1134,7 +1148,7 @@ export function LovartHome({ icon={LogOut} label="退出登录" onClick={() => { - void signOut({ redirect: true, callbackUrl: "/" }); + void handleLogout(); }} /> @@ -1576,10 +1590,11 @@ export function LovartHome({ {loginDialogOpen ? ( @@ -1754,7 +1769,7 @@ export function LovartHome({ variant="ghost" className="h-8 rounded-xl border border-black/10 bg-white px-3 text-[12px] text-black/75 hover:bg-black/5" onClick={() => { - void signOut({ redirect: true, callbackUrl: "/" }); + void handleLogout(); }} > 退出登录