discord-clone/lib/current-profile.ts

19 lines
321 B
TypeScript
Raw Normal View History

2023-10-08 18:18:17 -07:00
import { auth } from "@clerk/nextjs";
import { db } from "@/lib/db";
export const currentProfile = async () => {
const { userId } = auth();
if (!userId) {
return null;
}
const profile = await db.profile.findUnique({
where: {
userId
},
});
return profile;
}