From 08e2d21f7d686f9c828c338478086738ecde7942 Mon Sep 17 00:00:00 2001 From: APAW Agent Sync Date: Thu, 14 May 2026 09:26:22 +0100 Subject: [PATCH] fix(client): use getAdminProperties in admin panel - Add getAdminProperties() to api.js with admin endpoint - Update admin.js loadProperties() to use getAdminProperties - Returns full dataset with admin filtering support Refs: production admin panel --- public/js/admin.js | 2 +- public/js/api.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/public/js/admin.js b/public/js/admin.js index 4a70e18..84c096f 100644 --- a/public/js/admin.js +++ b/public/js/admin.js @@ -207,7 +207,7 @@ class AdminPanel { // ============ PROPERTIES ============ async loadProperties() { try { - const res = await API.getProperties({ lang: this.lang, limit: 100 }) + const res = await API.getAdminProperties({ status: 'active', limit: 100 }) if (res.success) { this.properties = res.data; this.renderPropertiesGrid() } } catch (e) { console.error('Failed to load properties:', e) } } diff --git a/public/js/api.js b/public/js/api.js index fd48ad4..a201176 100644 --- a/public/js/api.js +++ b/public/js/api.js @@ -261,6 +261,12 @@ class API { return response.json(); } + static async getAdminProperties(filters = {}) { + const params = new URLSearchParams(filters).toString(); + const response = await fetch(`${API_BASE}/admin/properties${params ? '?' + params : ''}`, { credentials: 'include' }); + return response.json(); + } + static async getAdminStats() { const response = await fetch(`${API_BASE}/admin/stats`, { credentials: 'include' }); return response.json();