import { useParams, Link } from 'react-router-dom' import { usePurchase } from '../hooks/useApi.ts' import { StoreIcon } from '../components/StoreIcon.tsx' export function PurchaseDetail() { const { id } = useParams<{ id: string }>() const { data: purchase, isLoading, error } = usePurchase(id ?? '') if (isLoading) { return (
Purchase not found.
Back to purchases{new Date(purchase.date).toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric', year: 'numeric', })}
{item.name}
{item.quantity > 1 && ({item.quantity} × ${item.unitPrice.toFixed(2)}
)}