Clean up API client - use nested propertyInformation directly
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:
Claw AI
2026-03-26 23:27:28 +00:00
parent fd3dcf4cc3
commit 211ac42ad9
4 changed files with 9 additions and 62 deletions

View File

@ -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,