Skip to content

feat: Replace direct UNESCO image URL with backend proxy URL in HeritageCard #472

@zigzagdev

Description

@zigzagdev

Parent issue

#475

Overview

Update the HeritageCard React component to point <img src> at the backend proxy endpoint instead of the raw UNESCO URL.

Implementation

// Build proxy URL from the record's primary key
const backendApiUrl = `${process.env.NEXT_PUBLIC_API_BASE_URL}/api/heritage-image/${item.id}`;

// In JSX, replace the existing <img> with:
{item.id && !isImgError ? (
  <img
    src={backendApiUrl}
    alt={title}
    className="h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"
    crossOrigin="anonymous"
    onError={() => setIsImgError(true)}
  />
) : (
  // existing placeholder SVG
)}

Acceptance criteria

  • <img src> points to /api/heritage-image/{id} (via env var base URL)
  • crossOrigin="anonymous" is set
  • onError still triggers the placeholder fallback

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions