13 lines
245 B
TypeScript
13 lines
245 B
TypeScript
import "server-only";
|
|
|
|
import { cache } from "react";
|
|
import { auth } from "@/auth";
|
|
|
|
export const getCurrentUser = cache(async () => {
|
|
const session = await auth();
|
|
if (!session?.user) {
|
|
return undefined;
|
|
}
|
|
return session.user;
|
|
});
|