Fix getCurrentSession for NextAuth v4 compatibility
This commit is contained in:
@@ -195,7 +195,8 @@ export async function logoutUser(): Promise<void> {
|
||||
*/
|
||||
export async function getCurrentSession() {
|
||||
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)
|
||||
return session
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user