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() {
|
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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user