mirror of
https://github.com/Retropex/custom-ocean.xyz-dashboard.git
synced 2025-05-12 11:10:44 +02:00
Remove duplicated saveConfig function from boot.html
This commit is contained in:
parent
bdb9552576
commit
8c1c55c83f
@ -521,35 +521,6 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Save configuration
|
|
||||||
function saveConfig() {
|
|
||||||
const wallet = document.getElementById('wallet-address').value.trim();
|
|
||||||
const powerCost = parseFloat(document.getElementById('power-cost').value) || 0;
|
|
||||||
const powerUsage = parseFloat(document.getElementById('power-usage').value) || 0;
|
|
||||||
const timezone = document.getElementById('timezone').value;
|
|
||||||
|
|
||||||
const updatedConfig = {
|
|
||||||
wallet: wallet || (currentConfig ? currentConfig.wallet : ""),
|
|
||||||
power_cost: powerCost,
|
|
||||||
power_usage: powerUsage,
|
|
||||||
timezone: timezone
|
|
||||||
};
|
|
||||||
|
|
||||||
return fetch('/api/config', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
},
|
|
||||||
body: JSON.stringify(updatedConfig)
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error('Failed to save configuration');
|
|
||||||
}
|
|
||||||
return response.json();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Safety timeout: redirect after 120 seconds if boot not complete
|
// Safety timeout: redirect after 120 seconds if boot not complete
|
||||||
window.addEventListener('load', function () {
|
window.addEventListener('load', function () {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user