Files
mnote/wolai-frontend/convex/users.ts
T

18 lines
358 B
TypeScript
Raw Normal View History

2026-01-18 05:13:53 +08:00
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);
},
});