0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-06-18 15:41:22 +02:00

return substituted ssid on save settings response

This commit is contained in:
peteruithoven 2013-10-18 12:57:28 +02:00
parent e87641d76a
commit b5465a43fd

View File

@ -3,6 +3,7 @@ local utils = require('util.utils')
local settings = require('util.settings')
local printer = require('util.printer')
local signin = require('network.signin')
local wifi = require('network.wlanconfig')
local M = {
isApi = true
@ -22,17 +23,25 @@ end
function M._global_POST(request, response)
--log:info("API:config:set")
response:setSuccess()
local validation = {}
for k,v in pairs(request:getAll()) do
--log:info(" "..k..": "..v);
local r,m = settings.set(k, v)
if r then
response:addData(k, "ok")
--response:addData(k, "ok")
validation[k] = "ok"
else
response:addData(k, "could not save setting ('" .. m .. "')")
--response:addData(k, "could not save setting ('" .. m .. "')")
validation[k] = "could not save setting ('" .. m .. "')"
log:info(" m: "..utils.dump(m))
end
end
response:addData("validation",validation)
local substitutedSsid = wifi.getSubstitutedSsid(settings.get('network.ap.ssid'))
response:addData("substituted_ssid",substitutedSsid)
log:info("API:Network:try signing in")
if signin.signin() then