Browse Source

gluon-web-wifi-config: make the code a bit nicer

simple-uci will now delete an option when nil is passed.
Matthias Schiffer 7 years ago
parent
commit
73ad23936e

+ 2 - 3
package/gluon-web-wifi-config/luasrc/lib/gluon/web/model/admin/wifi-config.lua

@@ -92,10 +92,9 @@ uci:foreach('wireless', 'wifi-device', function(config)
 
 	function tp:write(data)
 		if data == 'default' then
-			uci:delete('wireless', radio, 'txpower')
-		else
-			uci:set('wireless', radio, 'txpower', data)
+			data = nil
 		end
+		uci:set('wireless', radio, 'txpower', data)
 	end
 end)