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
+17
View File
@@ -0,0 +1,17 @@
import { query } from "./_generated/server";
import { getAuthUserId } from "@convex-dev/auth/server";
/**
* 获取当前登录用户
*/
export const currentUser = query({
args: {},
handler: async (ctx) => {
const userId = await getAuthUserId(ctx);
if (userId === null) {
return null;
}
return await ctx.db.get(userId);
},
});