Fix display settings save error by adding missing config_type parameter (#58)

- Added config_type='main' to FormData when submitting display form
- Added proper HTTP error handling to catch non-JSON responses
- This fixes the 'Unexpected token <' JSON parsing error when saving display settings
This commit is contained in:
Chuck
2025-09-21 21:12:38 -04:00
committed by GitHub
parent 1dcda5613a
commit 8cad607d98

View File

@@ -2764,12 +2764,18 @@
document.getElementById('display-form').addEventListener('submit', async function(e) { document.getElementById('display-form').addEventListener('submit', async function(e) {
e.preventDefault(); e.preventDefault();
const formData = new FormData(this); const formData = new FormData(this);
formData.append('config_type', 'main');
try { try {
const response = await fetch('/save_config', { const response = await fetch('/save_config', {
method: 'POST', method: 'POST',
body: formData body: formData
}); });
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
const result = await response.json(); const result = await response.json();
showNotification(result.message, result.status); showNotification(result.message, result.status);
} catch (error) { } catch (error) {