fix: skip device config save when sync is enabled — prevents 'Invalid device config' blocking settings save
This commit is contained in:
@@ -459,7 +459,8 @@ form.addEventListener('submit', async event => {
|
|||||||
}
|
}
|
||||||
populateRemoteConfig(remoteConfigResult);
|
populateRemoteConfig(remoteConfigResult);
|
||||||
|
|
||||||
// Save device config
|
// Save device config (skip if sync is enabled — server is source of truth)
|
||||||
|
if (!fields.deviceSyncEnabled.checked) {
|
||||||
const deviceConfigResponse = await fetch('/api/device-config', {
|
const deviceConfigResponse = await fetch('/api/device-config', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {'Content-Type': 'application/json'},
|
headers: {'Content-Type': 'application/json'},
|
||||||
@@ -471,6 +472,7 @@ form.addEventListener('submit', async event => {
|
|||||||
throw new Error(deviceConfigResult.error || `HTTP ${deviceConfigResponse.status}`);
|
throw new Error(deviceConfigResult.error || `HTTP ${deviceConfigResponse.status}`);
|
||||||
}
|
}
|
||||||
populateDeviceConfig(deviceConfigResult);
|
populateDeviceConfig(deviceConfigResult);
|
||||||
|
}
|
||||||
|
|
||||||
showMessage('Settings saved.', 'success');
|
showMessage('Settings saved.', 'success');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user