mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 13:02:59 +00:00
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:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user