import { apiGet, type Noticia, type ServerStatus } from '@/lib/api' // SSR por petición: los datos se obtienen en el servidor Next desde la API Django. // (En Next 16 fetch no se cachea por defecto; force-dynamic lo deja explícito.) export const dynamic = 'force-dynamic' async function getData(): Promise<{ noticias: Noticia[]; status: ServerStatus | null }> { const [news, status] = await Promise.allSettled([ apiGet<{ noticias: Noticia[] }>('/api/home/news/'), apiGet('/api/home/status/'), ]) return { noticias: news.status === 'fulfilled' ? news.value.noticias : [], status: status.status === 'fulfilled' ? status.value : null, } } export default async function HomePage() { const { noticias, status } = await getData() return (

Nova WoW

Estado del servidor

{status ? (
  • Servidor: {status.server_name ?? '—'} ({status.expansion})
  • Personajes en línea: {status.online_characters}
  • Login:{' '} {status.status}
  • Dirección: {status.address ?? '—'}
) : (

No disponible.

)}

Noticias

{noticias.length === 0 ? (

No hay noticias disponibles en este momento.

) : ( noticias.map((n) => (

{n.titulo}

{n.fecha && {new Date(n.fecha).toLocaleString('es-ES')}}
{n.enlace && (

Enlace:{' '} aquí

)}
)) )}
) }