import { getMemberToken, getApiBaseUrl } from '../../../_lib/api'; import Link from 'next/link'; import { notFound } from 'next/navigation'; interface AlbumDetail { id: string; title: string; description: string | null; items: Array<{ id: string; mediaUrl: string; caption: string | null }>; } async function fetchAlbum(token: string, id: string): Promise { const res = await fetch(`${getApiBaseUrl()}/my/memories/${id}`, { headers: { Authorization: `Bearer ${token}` }, cache: 'no-store', }).catch(() => null); if (!res || !res.ok) return null; return (await res.json()) as AlbumDetail; } export default async function AlbumPage({ params }: { params: Promise<{ id: string }> }) { const token = await getMemberToken(); if (!token) return null; const { id } = await params; const album = await fetchAlbum(token, id); if (!album) notFound(); return (

{album.title}

{album.description &&

{album.description}

}
← Albums
{album.items.length === 0 ? (

This album has no photos yet.

) : (
{album.items.map((item) => (
{/* eslint-disable-next-line @next/next/no-img-element */} {item.caption
{item.caption && (
{item.caption}
)}
))}
)}
); }