refactor(auth): switch to class-based social login and v4 route handler

Migrate from function-based social login helpers (`facebookLogin`, `googleLogin`)
to class-based services (`new FacebookLogin().signIn()`, `new GoogleLogin().signIn()`),
updating call sites in `AuthFacebookPanel` and `SplashButton` with try/catch error
handling. The NextAuth route handler is also refactored to the v4 pattern, importing
pre-built `GET` / `POST` exports from `@/lib/auth/nextauth` instead of constructing
the handler inline with `NextAuth(authOptions)`.
This commit is contained in:
2026-06-10 15:34:52 +08:00
parent 90bb711a45
commit d70e61f92e
115 changed files with 9004 additions and 493 deletions
+4 -9
View File
@@ -1,8 +1,7 @@
/**
* NextAuth App Router 入口
* NextAuth App Router 入口v4 模式)
*
* 路径:/api/auth/[...nextauth]
* 自动处理 NextAuth 所有内置路由:
* v4 用单个 handler 函数,需手动 re-export 为 `GET` / `POST`
* /api/auth/signin/[provider]
* /api/auth/callback/[provider]
* /api/auth/signout
@@ -10,10 +9,6 @@
* /api/auth/csrf
* /api/auth/providers
*/
import NextAuth from "next-auth";
import { GET, POST } from "@/lib/auth/nextauth";
import { authOptions } from "@/lib/auth/config";
const handler = NextAuth(authOptions);
export { handler as GET, handler as POST };
export { GET, POST };