Clean up API client - use nested propertyInformation directly
All checks were successful
Build frontend / build (push) Successful in 42s
All checks were successful
Build frontend / build (push) Successful in 42s
- Removed manual enrichment calls (Properties/Get fallback no longer needed) - Removed unused hasNestedInfo variables - API now returns propertyInformation nested in RentProperties/SaleProperties
This commit is contained in:
@ -31,11 +31,9 @@ import Image from 'next/image';
|
||||
import { getRentProperties, getSaleProperties } from './utils/api';
|
||||
|
||||
// Map API property data to the format the UI expects
|
||||
// API returns { propInfoId, deposit, monthlyRent, dailyRent, rating, ... }
|
||||
// If propertyInformation is nested, use it; otherwise use flat response with defaults
|
||||
// API returns { propertyInformationId, deposit, monthlyRent, dailyRent, rating, propertyInformation: {...}, ... }
|
||||
function mapApiProperty(item, index) {
|
||||
const info = item.propertyInformation || {};
|
||||
const hasNestedInfo = !!item.propertyInformation;
|
||||
|
||||
const dailyPrice = item.dailyRent ?? item.monthlyRent ?? item.price ?? 0;
|
||||
const monthlyPrice = item.monthlyRent ?? 0;
|
||||
@ -57,7 +55,6 @@ function mapApiProperty(item, index) {
|
||||
|
||||
return {
|
||||
id: item.id ?? index + 1,
|
||||
propInfoId: item.propInfoId,
|
||||
title: info.address || `عقار #${item.id || index + 1}`,
|
||||
description: info.description || '',
|
||||
type: propType,
|
||||
|
||||
Reference in New Issue
Block a user