From 2ac4b2ec0333cbdfa97813a7160d257e7a095ef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Dvo=C5=99=C3=A1k?= <150935816+Dvorinka@users.noreply.github.com> Date: Fri, 23 May 2025 10:20:06 +0200 Subject: [PATCH] Add files via upload --- kontakt/index.html | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/kontakt/index.html b/kontakt/index.html index d550be8..c57d3df 100644 --- a/kontakt/index.html +++ b/kontakt/index.html @@ -136,30 +136,21 @@ async function loadContacts() { try { - showLoading(); - const response = await fetch('http://localhost:8081/contacts'); - - if (!response.ok) { - throw new Error(`HTTP ${response.status}: ${response.statusText}`); - } - + const response = await fetch('/contacts'); const apiData = await response.json(); - // Transform API data to match our expected structure + // Directly use the API data structure currentData = { - Contacts: apiData.contacts.filter(c => !c.name.includes('Interní')), - InternalContacts: apiData.contacts.filter(c => c.name.includes('Interní')), + Contacts: apiData.contacts || [], + InternalContacts: apiData.internal_contacts || [], last_updated: apiData.last_updated }; - hideLoading(); showContactsList(); updateStats(currentData); - filterContacts(); } catch (error) { + showError('Chyba při načítání kontaktů'); console.error('Error loading contacts:', error); - hideLoading(); - showError(error.message); } } @@ -325,7 +316,7 @@ `; try { - const response = await fetch('http://localhost:8081/reload', { method: 'POST' }); + const response = await fetch('/reload', { method: 'POST' }); if (!response.ok) { throw new Error(`HTTP ${response.status}: ${response.statusText}`); }