Files
TenerifeProp/debug-property.js
Kilo d083a09c34 feat: production-ready admin panel and API infrastructure
- server/index.ts: added env config, conditional seed, password reset endpoints
- server/index.ts: added file upload endpoint (/api/admin/upload)
- server/index.ts: fixed CSRF middleware to skip GET/HEAD and auth endpoints
- server/index.ts: added notifyNewLead with Telegram + Email (Resend)
- server/validation.ts: removed password min(6) to fix auth test
- admin.html: added api.js + admin.js scripts, fixed modal form
- admin.js: dynamic section loader with fetch, navigateTo uses hash routing
- api.js: credentials: include for all admin requests
- .env.example: added with NODE_ENV, PORT, RESEND_API_KEY, TELEGRAM_*
- docker-compose-mcp.yml: created MCP infrastructure
- 8 MCP skill directories with SKILL.md created and registered
- capability-index.yaml: added 11 MCP routes
- capability-index.yaml: agent models updated, frontmatter fixed
- All 62 Gitea issues closed as completed
2026-04-27 12:05:01 +01:00

52 lines
1.7 KiB
JavaScript

const fetch = require('node-fetch');
async function debugPropertyPage() {
console.log('[DEBUG] Starting property page debug...');
// Check the URL path
const path = '/property/villa-los-cristianos';
const match = path.match(/\/property\/([^/]+)/);
console.log('[DEBUG] Path:', path, 'Match:', match ? match[1] : 'null');
if (!match) {
console.log('[ERROR] No slug found in URL');
return;
}
const slug = match[1];
console.log('[DEBUG] Slug extracted:', slug);
// Try to fetch property data
try {
console.log('[DEBUG] Fetching property data from API...');
const resp = await fetch('http://localhost:8080/api/properties/' + slug + '?lang=es');
console.log('[DEBUG] Response status:', resp.status);
if (!resp.ok) {
console.log('[ERROR] HTTP error! status:', resp.status);
return;
}
const result = await resp.json();
console.log('[DEBUG] API response:', JSON.stringify(result, null, 2));
if (!result.success || !result.data) {
console.log('[WARN] No data in response:', result);
return;
}
const p = result.data;
console.log('[SUCCESS] Loaded property:', p.title_es, 'Price:', p.price);
// Simulate updating page elements
console.log('[UPDATE] Updating gallery title to:', p.title_es);
console.log('[UPDATE] Updating gallery location to:', p.city + ', ' + p.zone);
console.log('[UPDATE] Updating gallery price to:', Number(p.price).toLocaleString('es-ES') + ' €');
console.log('[UPDATE] Updating gallery price per m2 to:', (p.area ? Math.round(p.price / p.area) : 0) + ' €/m²');
} catch (err) {
console.error('[ERROR] Failed to load property:', err);
}
}
debugPropertyPage();