Fix all NextAuth v4 imports across codebase

This commit is contained in:
2025-12-02 14:03:13 +00:00
parent 2f7bc4fe8e
commit d7297248c1
11 changed files with 48 additions and 39 deletions

View File

@@ -1,4 +1,5 @@
import { auth } from '@/auth'
import { getServerSession } from 'next-auth'
import { authOptions } from '@/pages/api/auth/[...nextauth]'
import { redirect } from 'next/navigation'
import { getInvitations } from '@/lib/sharing-actions'
import InvitationCard from '@/components/InvitationCard'
@@ -27,7 +28,7 @@ type Invitation = {
}
export default async function InvitationsPage() {
const session = await auth()
const session = await getServerSession(authOptions)
if (!session?.user) {
redirect('/auth/login')

View File

@@ -1,7 +1,8 @@
import { notFound } from 'next/navigation'
import { getItem } from '@/lib/actions'
import { canEditList } from '@/lib/permissions'
import { auth } from '@/auth'
import { getServerSession } from 'next-auth'
import { authOptions } from '@/pages/api/auth/[...nextauth]'
import ItemForm from '@/components/ItemForm'
import Link from 'next/link'
import { ArrowLeft } from 'lucide-react'
@@ -16,7 +17,7 @@ interface PageProps {
}
export default async function EditItemPage({ params }: PageProps) {
const session = await auth()
const session = await getServerSession(authOptions)
if (!session?.user?.id) {
notFound()
}

View File

@@ -1,7 +1,8 @@
import { notFound } from 'next/navigation'
import { getItem } from '@/lib/actions'
import { canEditList } from '@/lib/permissions'
import { auth } from '@/auth'
import { getServerSession } from 'next-auth'
import { authOptions } from '@/pages/api/auth/[...nextauth]'
import ItemDetail from '@/components/ItemDetail'
import Link from 'next/link'
import { ArrowLeft, Edit } from 'lucide-react'
@@ -18,7 +19,7 @@ interface PageProps {
}
export default async function ItemDetailPage({ params }: PageProps) {
const session = await auth()
const session = await getServerSession(authOptions)
if (!session?.user?.id) {
notFound()
}

View File

@@ -1,6 +1,7 @@
import { getListWithItems } from '@/lib/actions'
import { getPermission } from '@/lib/permissions'
import { auth } from '@/auth'
import { getServerSession } from 'next-auth'
import { authOptions } from '@/pages/api/auth/[...nextauth]'
import { notFound } from 'next/navigation'
import Link from 'next/link'
import { ArrowLeft } from 'lucide-react'
@@ -10,7 +11,7 @@ import ListDetailView from '@/components/ListDetailView'
export const dynamic = 'force-dynamic'
export default async function ListDetailPage({ params }: { params: { id: string } }) {
const session = await auth()
const session = await getServerSession(authOptions)
if (!session?.user?.id) {
notFound()
}

View File

@@ -4,13 +4,14 @@ import NewListButton from '@/components/NewListButton'
import GlobalSearch from '@/components/GlobalSearch'
import EmptyState from '@/components/EmptyState'
import Link from 'next/link'
import { auth } from '@/auth'
import { getServerSession } from 'next-auth'
import { authOptions } from '@/pages/api/auth/[...nextauth]'
import { redirect } from 'next/navigation'
export const dynamic = 'force-dynamic'
export default async function Home() {
const session = await auth()
const session = await getServerSession(authOptions)
if (!session?.user) {
redirect('/auth/login')

View File

@@ -1,5 +1,6 @@
import { redirect } from 'next/navigation'
import { auth } from '@/auth'
import { getServerSession } from 'next-auth'
import { authOptions } from '@/pages/api/auth/[...nextauth]'
import { getUserProfile } from '@/lib/auth-actions'
import ProfileForm from '@/components/ProfileForm'
import PasswordChangeForm from '@/components/PasswordChangeForm'
@@ -11,7 +12,7 @@ export const metadata = {
}
export default async function ProfilePage() {
const session = await auth()
const session = await getServerSession(authOptions)
if (!session?.user?.id) {
redirect('/auth/login')