Remove all fallback dummy data - API-only
All checks were successful
Build frontend / build (push) Successful in 38s
All checks were successful
Build frontend / build (push) Successful in 38s
- Removed FALLBACK_PROPERTIES from main page, properties listing, and property detail - Pages now start empty and populate only from API responses - Show empty state / error on API failure instead of dummy data
This commit is contained in:
@ -122,39 +122,7 @@ function mapApiDetail(item) {
|
||||
|
||||
// extractCity is now imported from @/app/enums
|
||||
|
||||
// Fallback data (same as before)
|
||||
const FALLBACK_PROPERTIES = {
|
||||
1: {
|
||||
id: 1,
|
||||
title: 'فيلا فاخرة في المزة',
|
||||
description: `تتميز هذه الفيلا الفاخرة بتصميمها العصري وموقعها المميز في أفضل أحياء دمشق.`,
|
||||
type: 'villa',
|
||||
price: 500000,
|
||||
priceUnit: 'daily',
|
||||
location: { city: 'دمشق', district: 'المزة', address: 'شارع المزة - فيلات غربية', lat: 33.5, lng: 36.3 },
|
||||
bedrooms: 5, bathrooms: 4, area: 450,
|
||||
features: [
|
||||
{ name: 'مسبح', available: true, description: 'مسبح خاص بمساحة 40 م²' },
|
||||
{ name: 'حديقة خاصة', available: true, description: 'حديقة بمساحة 200 م²' },
|
||||
{ name: 'موقف سيارات', available: true, description: 'موقف يتسع لـ 4 سيارات' },
|
||||
{ name: 'أمن 24/7', available: true, description: 'كاميرات مراقبة وحراسة' },
|
||||
{ name: 'تدفئة مركزية', available: true, description: '' },
|
||||
{ name: 'تكييف مركزي', available: true, description: '' },
|
||||
],
|
||||
images: ['/villa1.jpg', '/villa2.jpg', '/villa3.jpg'],
|
||||
status: 'available', rating: 4.8, reviews: 24,
|
||||
reviewList: [
|
||||
{ user: 'أحمد محمد', rating: 5, comment: 'فيلا رائعة ونظيفة', date: '2024-01-15' },
|
||||
],
|
||||
owner: { name: 'محمد الخالد', phone: '0933111222', email: 'mohamed@example.com', rating: 4.9, properties: 5, memberSince: '2023', responseRate: '98%', responseTime: 'خلال ساعة' },
|
||||
nearby: [
|
||||
{ type: 'مدرسة', distance: '500م' },
|
||||
{ type: 'مستشفى', distance: '1كم' },
|
||||
],
|
||||
specifications: { constructionYear: 2022, floor: 'أرضي + 2', parking: 4, gardenArea: 200, poolArea: 40, furnished: true, airConditioning: 'مركزي', heating: 'مركزي', electricity: '220V', water: 'شبكة عامة' },
|
||||
rules: ['لا يسمح بالحيوانات الأليفة', 'لا يسمح بالتدخين داخل الغرف'],
|
||||
},
|
||||
};
|
||||
// API-only — no fallback data
|
||||
|
||||
export default function PropertyDetailsPage() {
|
||||
const params = useParams();
|
||||
@ -195,19 +163,10 @@ export default function PropertyDetailsPage() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback to local data
|
||||
const fallback = FALLBACK_PROPERTIES[id];
|
||||
if (fallback) {
|
||||
setProperty(fallback);
|
||||
} else {
|
||||
// Use property 1 as last resort
|
||||
setProperty(FALLBACK_PROPERTIES[1] || null);
|
||||
}
|
||||
setProperty(null);
|
||||
} catch (err) {
|
||||
console.warn('Failed to fetch property, using fallback:', err);
|
||||
const fallback = FALLBACK_PROPERTIES[id];
|
||||
setProperty(fallback || FALLBACK_PROPERTIES[1] || null);
|
||||
console.error('[Property] Failed to fetch property:', err);
|
||||
setProperty(null);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user