a
This commit is contained in:
@@ -9,3 +9,18 @@ export const getCurrent = query({
|
||||
return await ctx.db.get(userId);
|
||||
},
|
||||
});
|
||||
|
||||
export const getCurrentProfile = query({
|
||||
args: {},
|
||||
handler: async (ctx) => {
|
||||
const userId = await getAuthUserId(ctx);
|
||||
if (!userId) return null;
|
||||
const user = await ctx.db.get(userId);
|
||||
if (!user) return null;
|
||||
const accounts = await ctx.db
|
||||
.query("authAccounts")
|
||||
.withIndex("userIdAndProvider", (q) => q.eq("userId", userId))
|
||||
.collect();
|
||||
return { user, accounts };
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user