Files
wr.do/lib/session.ts
2024-07-26 22:08:57 +08:00

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;
});