taxonomy/lib/session.ts

14 lines
300 B
TypeScript
Raw Permalink Normal View History

2022-11-08 04:35:26 +00:00
import { unstable_getServerSession } from "next-auth/next"
2022-10-26 13:18:06 +00:00
2022-11-07 12:37:47 +00:00
import { authOptions } from "@/lib/auth"
2022-10-26 13:18:06 +00:00
2022-11-07 12:37:47 +00:00
export async function getSession() {
return await unstable_getServerSession(authOptions)
}
2022-10-26 13:18:06 +00:00
2022-11-07 12:37:47 +00:00
export async function getCurrentUser() {
const session = await getSession()
2022-10-26 13:18:06 +00:00
2022-11-07 12:37:47 +00:00
return session?.user
2022-10-26 13:18:06 +00:00
}