mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-04 12:32:59 +00:00
Add files via upload
This commit is contained in:
+6
-15
@@ -136,30 +136,21 @@
|
|||||||
|
|
||||||
async function loadContacts() {
|
async function loadContacts() {
|
||||||
try {
|
try {
|
||||||
showLoading();
|
const response = await fetch('/contacts');
|
||||||
const response = await fetch('http://localhost:8081/contacts');
|
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const apiData = await response.json();
|
const apiData = await response.json();
|
||||||
|
|
||||||
// Transform API data to match our expected structure
|
// Directly use the API data structure
|
||||||
currentData = {
|
currentData = {
|
||||||
Contacts: apiData.contacts.filter(c => !c.name.includes('Interní')),
|
Contacts: apiData.contacts || [],
|
||||||
InternalContacts: apiData.contacts.filter(c => c.name.includes('Interní')),
|
InternalContacts: apiData.internal_contacts || [],
|
||||||
last_updated: apiData.last_updated
|
last_updated: apiData.last_updated
|
||||||
};
|
};
|
||||||
|
|
||||||
hideLoading();
|
|
||||||
showContactsList();
|
showContactsList();
|
||||||
updateStats(currentData);
|
updateStats(currentData);
|
||||||
filterContacts();
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
showError('Chyba při načítání kontaktů');
|
||||||
console.error('Error loading contacts:', error);
|
console.error('Error loading contacts:', error);
|
||||||
hideLoading();
|
|
||||||
showError(error.message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,7 +316,7 @@
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch('http://localhost:8081/reload', { method: 'POST' });
|
const response = await fetch('/reload', { method: 'POST' });
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user