Add files via upload

This commit is contained in:
Tomáš Dvořák
2025-05-23 12:14:50 +02:00
committed by GitHub
parent 0348365b92
commit 95a4523f50
2 changed files with 10 additions and 22 deletions
+9 -21
View File
@@ -552,33 +552,21 @@
try { try {
showMessage('Odesílání záznamu...', 'info'); showMessage('Odesílání záznamu...', 'info');
const res = await fetch('/api/trips', { const res = await fetch('/submit', {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data), body: JSON.stringify(data),
}); });
const text = await res.text(); const result = await res.json();
showMessage(result.message, 'success');
// Validate JSON response // Reset form but keep today's date
try { form.reset();
const result = JSON.parse(text); dateStart.value = todayStr;
if (res.ok) { dateEnd.value = todayStr;
showMessage(result.message || 'Záznam úspěšně uložen', 'success'); totalDistance.textContent = '0 km';
totalTime.textContent = '0:00';
// Reset form but keep today's date
form.reset();
dateStart.value = todayStr;
dateEnd.value = todayStr;
totalDistance.textContent = '0 km';
totalTime.textContent = '0:00';
} else {
showMessage(result.error || 'Chyba při ukládání', 'error');
}
} catch (jsonError) {
console.error('Invalid JSON response:', text);
showMessage('Neplatná odpověď ze serveru', 'error');
}
} catch (err) { } catch (err) {
console.error(err); console.error(err);
showMessage('Nepodařilo se odeslat záznam. Zkontrolujte připojení k internetu.', 'error'); showMessage('Nepodařilo se odeslat záznam. Zkontrolujte připojení k internetu.', 'error');
+1 -1
View File
@@ -34,7 +34,7 @@ type ContactData struct {
var ( var (
currentData *ContactData currentData *ContactData
dataFile = "data/contacts.json" dataFile = "data/contacts.json"
xlsxFile = "TelefonniSeznamWeb.xlsx" xlsxFile = "/mnt/telefony/TelefonniSeznamWeb.xlsx"
) )
func startAutoReload() { func startAutoReload() {