Fix getCurrentSession for NextAuth v4 compatibility

This commit is contained in:
2025-12-02 14:12:22 +00:00
parent d92f13fdc4
commit ade7ad19d6

View File

@@ -195,7 +195,8 @@ export async function logoutUser(): Promise<void> {
*/ */
export async function getCurrentSession() { export async function getCurrentSession() {
try { try {
const { auth } = await import('@/auth') const { getServerSession } = await import('next-auth/next')
const { authOptions } = await import('@/pages/api/auth/[...nextauth]')
const session = await getServerSession(authOptions) const session = await getServerSession(authOptions)
return session return session
} catch (error) { } catch (error) {