blog dynamic
This commit is contained in:
parent
14c92b0d2f
commit
cc1916cb09
@ -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)}
|
||||
>
|
||||
<img
|
||||
src={image.src}
|
||||
src={image.src || '/assets/img/all-images/memory/memory-img4.png'}
|
||||
alt={image.title || `gallery-${index}`}
|
||||
loading="lazy"
|
||||
style={{ width: '100%', height: 'auto' }}
|
||||
onError={(e: any) => {
|
||||
e.target.onerror = null;
|
||||
e.target.src = '/assets/img/all-images/memory/memory-img4.png';
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -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,8 +95,12 @@ export default function PhotoGallerySection() {
|
||||
<div className="img1">
|
||||
<Link href={`/photo-gallery/single-gallery?id=${event.id}`}>
|
||||
<img
|
||||
src={event.eventimageurl}
|
||||
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';
|
||||
}}
|
||||
/>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
@ -148,7 +148,7 @@ export default function UpcomingEventSinglePage({ slug: propSlug }) {
|
||||
}}
|
||||
>
|
||||
<img
|
||||
src={event.image}
|
||||
src={event.image || '/assets/img/all-images/memory/memory-img4.png'}
|
||||
alt={event.title}
|
||||
style={{
|
||||
width: "100%",
|
||||
@ -156,6 +156,10 @@ export default function UpcomingEventSinglePage({ slug: propSlug }) {
|
||||
height: "auto",
|
||||
objectFit: "contain",
|
||||
}}
|
||||
onError={(e) => {
|
||||
e.target.onerror = null;
|
||||
e.target.src = '/assets/img/all-images/memory/memory-img4.png';
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -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
|
||||
src={img.src}
|
||||
src={img.src || '/assets/img/all-images/memory/memory-img4.png'}
|
||||
alt={img.alt || `gallery-${index}`}
|
||||
loading="lazy"
|
||||
style={{ width: '100%', height: 'auto' }}
|
||||
onError={(e: any) => {
|
||||
e.target.onerror = null;
|
||||
e.target.src = '/assets/img/all-images/memory/memory-img4.png';
|
||||
}}
|
||||
/>
|
||||
<h3>{img?.eventtitle}</h3>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user