refactor(auth): migrate social login to next-auth

This commit is contained in:
2026-06-10 10:26:45 +08:00
parent 109a3e3855
commit a4b902893e
34 changed files with 572 additions and 1421 deletions
+3 -7
View File
@@ -16,7 +16,7 @@ import { useRouter } from "next/navigation";
import { useAuthState, useAuthDispatch } from "@/stores/auth/auth-context";
import { useChatDispatch } from "@/stores/chat/chat-context";
import { useUserDispatch } from "@/stores/user/user-context";
import { useAuthGate } from "@/lib/auth/use-auth-gate";
import { useAuthGate } from "@/lib/auth/nextauth";
import { ROUTES } from "@/lib/routes";
import { MobileShell } from "@/app/_components/core/mobile-shell";
import { AuthPanel } from "@/app/auth/components/auth-panel";
@@ -42,7 +42,7 @@ export function AuthScreen({
if (isAuthed) router.replace(ROUTES.chat);
}, [isAuthed, router]);
// 登录成功 → 通知 Chat + User + 跳转
// 邮箱登录成功 → 通知 Chat + User + 跳转
useEffect(() => {
if (state.isSuccess && !wasSuccess.current) {
wasSuccess.current = true;
@@ -63,11 +63,7 @@ export function AuthScreen({
padding: "var(--spacing-lg)",
}}
>
<AuthPanel
onGoogleSuccess={(idToken, email) => {
authDispatch({ type: "AuthWebGoogleLoginSuccess", idToken, email });
}}
/>
<AuthPanel />
</div>
</MobileShell>
);