refactor(auth): remove AuthGate abstraction in favor of useSession
- Drop AuthGate/AuthGateState re-exports from @/lib/auth/nextauth - Simplify SplashButton by removing skipHref prop and hardcoding ROUTES.chat - Update comments to reference useSession() (next-auth/react) directly instead of the AuthGate wrapper, since the auth UI gate no longer needs the extra abstraction layer.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* `Row(children: [Skip 文本, SizedBox 26, Facebook 登录按钮])`
|
||||
*
|
||||
* 本组件是 splash 鉴权流程的**自治单元**:
|
||||
* - 消费 `useAuthGate`(内部用 useSession 监听 NextAuth session)
|
||||
* - 消费 `useSession()`(next-auth/react)监听 NextAuth session
|
||||
* - 消费 `useAuthState` / `useAuthDispatch`(邮箱登录流程)
|
||||
* - 消费 `useChatDispatch` / `useUserDispatch`(登录成功后初始化)
|
||||
* - 自管路由跳转(已登录 / 登录成功 → /chat)
|
||||
@@ -25,12 +25,7 @@ import { ROUTES } from "@/router/routes";
|
||||
import { LoadingIndicator } from "@/app/_components/core/loading-indicator";
|
||||
import styles from "./splash-button.module.css";
|
||||
|
||||
export interface SplashButtonProps {
|
||||
/** Skip 链接的目标路由(默认 /chat) */
|
||||
skipHref?: string;
|
||||
}
|
||||
|
||||
export function SplashButton({ skipHref = ROUTES.chat }: SplashButtonProps) {
|
||||
export function SplashButton() {
|
||||
// ===== 鉴权路由跳转已由 src/router/proxy.ts 集中处理 =====
|
||||
// 本组件只负责:
|
||||
// 1. 触发登录动作
|
||||
@@ -68,7 +63,7 @@ export function SplashButton({ skipHref = ROUTES.chat }: SplashButtonProps) {
|
||||
<div className={styles.wrapper}>
|
||||
{/* Skip 文本链接(next/link 渲染为 <a>,保留 SPA 体验) */}
|
||||
<Link
|
||||
href={skipHref}
|
||||
href={ROUTES.chat}
|
||||
className={styles.skip}
|
||||
aria-disabled={isLoading}
|
||||
tabIndex={isLoading ? -1 : 0}
|
||||
|
||||
Reference in New Issue
Block a user