0.3 增加登录模块

This commit is contained in:
liaibo
2026-01-18 05:13:53 +08:00
parent df2e9f5339
commit 90a38b48cf
86 changed files with 2041 additions and 148 deletions
@@ -28,13 +28,11 @@ export async function POST(request: Request) {
return NextResponse.json({ error: "缺少 requestId/callId" }, { status: 400 });
}
const userId = (() => {
if (isConvexEnabled()) {
const auth = requireAuthContext();
return auth.userId;
}
return null;
})();
let userId: string | null = null;
if (isConvexEnabled()) {
const auth = await requireAuthContext();
userId = auth.userId;
}
const resolvedUserId = async () => {
if (userId) return userId;
@@ -77,7 +77,7 @@ export async function POST(request: Request) {
const convexOn = isConvexEnabled();
const { userId, supabase, convexClient } = await (async () => {
if (convexOn) {
const { auth, client } = getAuthedConvexClient();
const { auth, client } = await getAuthedConvexClient();
return { userId: auth.userId, supabase: null as any, convexClient: client };
}
const supabase = await createSupabaseRouteClient();