luci-app-travelmate: sync with travelmate 0.9.0
[project/luci.git] / applications / luci-app-travelmate / luasrc / model / cbi / travelmate / wifi_delete.lua
diff --git a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_delete.lua b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_delete.lua
new file mode 100644 (file)
index 0000000..97ec1ca
--- /dev/null
@@ -0,0 +1,14 @@
+-- Copyright 2017 Dirk Brenken (dev@brenken.org)
+-- This is free software, licensed under the Apache License, Version 2.0
+
+local uci = require("luci.model.uci").cursor()
+local http = require("luci.http")
+local cfg = http.formvalue("cfg")
+
+if cfg ~= nil then
+       uci:delete("wireless", cfg)
+       uci:save("wireless")
+       uci:commit("wireless")
+end
+
+http.redirect(luci.dispatcher.build_url("admin/services/travelmate/stations"))