sarlink-portal/lib/auth-utils.ts

16 lines
351 B
TypeScript
Raw Normal View History

"use server";
import { headers } from "next/headers";
import { cache } from "react";
import { auth } from "./auth";
const getCurrentUserCache = cache(async () => {
const session = await auth.api.getSession({
headers: await headers(),
});
return session?.user;
});
export async function getCurrentUser() {
return await getCurrentUserCache();
}