Skip to content

Commit

Permalink
fix: refactor show_wifi_form to accept connection as parameter and re…
Browse files Browse the repository at this point in the history
…move unnecessary connection handling

Signed-off-by: Dengfeng Liu <[email protected]>
  • Loading branch information
liudf0716 committed Jan 16, 2025
1 parent 6c1047e commit be8e190
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions wifi-config
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,7 @@ local function render_javascript()
]]
end

local function show_wifi_form()
local conn = ubus.connect()
if not conn then
error("Failed to connect to ubus")
end

local function show_wifi_form(conn)
print([[
<div class="form-container" id="wifiFormContainer">
<h1>WiFi Configuration</h1>
Expand All @@ -266,7 +261,6 @@ local function show_wifi_form()
]])

print(render_javascript())
conn:close()
end

-- Main execution
Expand Down

0 comments on commit be8e190

Please sign in to comment.