From cc1916cb09b4e02c564d27313da0e7cb0df96b42 Mon Sep 17 00:00:00 2001 From: srikanth01234 Date: Thu, 20 Aug 2026 22:42:19 +0530 Subject: [PATCH] blog dynamic --- app/(event)/photo-gallery/single-gallery/page.tsx | 9 +++++++-- components/events/PhotoGallerySection.jsx | 13 +++++++++---- components/events/UpcomingEventSinglePage.jsx | 6 +++++- components/home/HomePhotoGallerySection.tsx | 9 +++++++-- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/app/(event)/photo-gallery/single-gallery/page.tsx b/app/(event)/photo-gallery/single-gallery/page.tsx index 82e0495..ad1de6d 100644 --- a/app/(event)/photo-gallery/single-gallery/page.tsx +++ b/app/(event)/photo-gallery/single-gallery/page.tsx @@ -26,8 +26,9 @@ export default function SingleGallery() { const getEventGallery = useCallback(async () => { try { + const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || 'https://api.tamilculturewaterloo.org/api'; const res = await axios.get( - `https://api.tamilculturewaterloo.org/api/event-images/event/${eventId}` + `${API_BASE_URL}/event-images/event/${eventId}` ); const formatted = res.data?.data?.map((img: any) => ({ id: img.id, @@ -109,10 +110,14 @@ export default function SingleGallery() { onClick={() => handleImageClick(index)} > {image.title { + e.target.onerror = null; + e.target.src = '/assets/img/all-images/memory/memory-img4.png'; + }} /> diff --git a/components/events/PhotoGallerySection.jsx b/components/events/PhotoGallerySection.jsx index fa5d439..be3a5d4 100644 --- a/components/events/PhotoGallerySection.jsx +++ b/components/events/PhotoGallerySection.jsx @@ -15,8 +15,9 @@ export default function PhotoGallerySection() { const getEvents = async () => { try { + const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || 'https://api.tamilculturewaterloo.org/api'; const eventRes = await axios.get( - 'https://api.tamilculturewaterloo.org/api/events/' + `${API_BASE_URL}/events/` ); const eventsData = eventRes?.data?.data || []; @@ -94,9 +95,13 @@ export default function PhotoGallerySection() {
{event.eventtitle} + src={event.eventimageurl || '/assets/img/all-images/memory/memory-img4.png'} + alt={event.eventtitle} + onError={(e) => { + e.target.onerror = null; + e.target.src = '/assets/img/all-images/memory/memory-img4.png'; + }} + />
diff --git a/components/events/UpcomingEventSinglePage.jsx b/components/events/UpcomingEventSinglePage.jsx index afe1f56..69daef2 100644 --- a/components/events/UpcomingEventSinglePage.jsx +++ b/components/events/UpcomingEventSinglePage.jsx @@ -148,7 +148,7 @@ export default function UpcomingEventSinglePage({ slug: propSlug }) { }} > {event.title} { + e.target.onerror = null; + e.target.src = '/assets/img/all-images/memory/memory-img4.png'; + }} />
diff --git a/components/home/HomePhotoGallerySection.tsx b/components/home/HomePhotoGallerySection.tsx index 8f9095e..c1df284 100644 --- a/components/home/HomePhotoGallerySection.tsx +++ b/components/home/HomePhotoGallerySection.tsx @@ -26,8 +26,9 @@ export default function HomePhotoGallerySection() { const getEvents = async () => { try { + const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || 'https://api.tamilculturewaterloo.org/api'; const eventRes = await axios.get( - 'https://api.tamilculturewaterloo.org/api/events/' + `${API_BASE_URL}/events/` ); const eventsData = eventRes?.data?.data || []; @@ -117,10 +118,14 @@ export default function HomePhotoGallerySection() { onClick={() => handleImageClick(index)} > {img.alt { + e.target.onerror = null; + e.target.src = '/assets/img/all-images/memory/memory-img4.png'; + }} />

{img?.eventtitle}