Display property images from API using full URLs
All checks were successful
Build frontend / build (push) Successful in 1m3s
All checks were successful
Build frontend / build (push) Successful in 1m3s
- All mappers extract images from propertyInformation.images - Paths prefixed with API base URL (http://45.93.137.91/api) - Falls back to placeholder if no images - Updated: main page, properties listing, property detail, owner properties
This commit is contained in:
@ -70,6 +70,13 @@ function mapApiDetail(item) {
|
||||
|
||||
const typeLabels = { 0: 'شقة', 1: 'فيلا', 2: 'بيت' };
|
||||
|
||||
// Extract images from API and build full URLs
|
||||
const apiBase = typeof window !== 'undefined' ? (process.env.NEXT_PUBLIC_API_URL || 'http://45.93.137.91/api') : '';
|
||||
const rawImages = Array.isArray(info.images) ? info.images : [];
|
||||
const images = rawImages.length > 0
|
||||
? rawImages.map(img => img.startsWith('http') ? img : `${apiBase}${img}`)
|
||||
: ['/property-placeholder.jpg', '/villa1.jpg', '/villa2.jpg'];
|
||||
|
||||
return {
|
||||
id: item.id,
|
||||
title: info.address || `عقار #${item.id}`,
|
||||
@ -90,7 +97,7 @@ function mapApiDetail(item) {
|
||||
features: features.length > 0 ? features : [
|
||||
{ name: 'متاح للإيجار', available: true, description: '' },
|
||||
],
|
||||
images: ['/property-placeholder.jpg', '/villa1.jpg', '/villa2.jpg'],
|
||||
images,
|
||||
status,
|
||||
rating: item.rating || 4.5,
|
||||
reviews: 0,
|
||||
|
||||
Reference in New Issue
Block a user