import { getServerSession } from 'next-auth'; import { authOptions } from '@/app/api/auth/[...nextauth]/route'; import { redirect } from 'next/navigation'; import { getAnnonceById } from '@/lib/services/annonceService'; import { getUserById } from '@/lib/services/userService'; import Link from 'next/link'; export default async function AnnonceDetail({ params }: { params: { id: string } }) { const session = await getServerSession(authOptions); if (!session) redirect('/'); const annonce = await getAnnonceById(Number(params.id)); if (!annonce) return
Annonce non trouvée.
; const agent = await getUserById(annonce.agentId); const formattedPrice = new Intl.NumberFormat('fr-FR', { style: 'currency', currency: 'EUR', minimumFractionDigits: 0 }).format(annonce.prix); return (
← Retour aux annonces
{/* Colonne principale (Image et Description) */}
{/* Image */}
{/* Titre et Adresse */}

{annonce.titre}

{annonce.address}, {annonce.ville}

{/* Description */}

Description

{annonce.description || 'Aucune description.'}

{/* Colonne latérale (Prix et Agent) */}
); }