import { notFound } from 'next/navigation' import { getItem } from '@/lib/actions' import { canEditList } from '@/lib/permissions' 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' export const dynamic = 'force-dynamic' interface PageProps { params: { id: string itemId: string } } export default async function EditItemPage({ params }: PageProps) { const session = await getServerSession(authOptions) if (!session?.user?.id) { notFound() } const item = await getItem(params.itemId) if (!item || item.listId !== params.id) { notFound() } // Check if user can edit this list const canEdit = await canEditList(session.user.id, params.id) return (
{/* Header */}
Back

Edit Task

{/* Form */}
) }