1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-13 05:53:06 +01:00

1st step to post request for config

This commit is contained in:
wellenvogel
2022-11-15 22:44:48 +01:00
parent 9d3a9a9c0d
commit 86139fc445
7 changed files with 220 additions and 72 deletions

View File

@@ -236,16 +236,24 @@ function changeConfig() {
ensurePass()
.then(function (pass) {
let newAdminPass;
let url = "/api/setConfig?_hash="+encodeURIComponent(pass)+"&";
let url = "/api/setConfig"
let body="hash="+encodeURIComponent(pass)+"&";
let allValues=getAllConfigs();
if (!allValues) return;
for (let name in allValues){
if (name == 'adminPassword'){
newAdminPass=allValues[name];
}
url += name + "=" + encodeURIComponent(allValues[name]) + "&";
body += encodeURIComponent(name) + "=" + encodeURIComponent(allValues[name]) + "&";
}
getJson(url)
fetch(url,{
method:'POST',
headers:{
'Content-Type': 'application/octet-stream' //we must lie here
},
body: body
})
.then((rs)=>rs.json())
.then(function (status) {
if (status.status == 'OK') {
if (newAdminPass !== undefined) {