From 8be02774ab84640f974a658c2a115d2d81fcf9f1 Mon Sep 17 00:00:00 2001 From: ehsan shariati Date: Thu, 2 Nov 2023 15:49:16 -0400 Subject: [PATCH] removed multiple writePropos (#173) --- wap/pkg/server/server.go | 14 ++------------ wap/pkg/wifi/wifi.go | 10 ---------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/wap/pkg/server/server.go b/wap/pkg/server/server.go index ea47ad3d..72ed80de 100644 --- a/wap/pkg/server/server.go +++ b/wap/pkg/server/server.go @@ -127,27 +127,17 @@ func propertiesHandler(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) jsonErr := json.NewEncoder(w).Encode(response) if jsonErr != nil { - http.Error(w, fmt.Sprintf("error building the response, %v", err), http.StatusInternalServerError) + http.Error(w, fmt.Sprintf("error building the response, %v", jsonErr), http.StatusInternalServerError) return } return } else if r.Method == "POST" { - ssid := r.FormValue("ssid") - password := r.FormValue("password") - - err := config.WriteProperties(map[string]interface{}{ - "ssid": ssid, - "password": password, - }) - if err != nil { - log.Errorw("failed to write the properties", "err", err) - } w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusCreated) jsonErr := json.NewEncoder(w).Encode(map[string]interface{}{"success": true}) if jsonErr != nil { - http.Error(w, fmt.Sprintf("error building the response, %v", err), http.StatusInternalServerError) + http.Error(w, fmt.Sprintf("error building the response, %v", jsonErr), http.StatusInternalServerError) return } } diff --git a/wap/pkg/wifi/wifi.go b/wap/pkg/wifi/wifi.go index 7ee6ef94..1dd8bc02 100644 --- a/wap/pkg/wifi/wifi.go +++ b/wap/pkg/wifi/wifi.go @@ -100,16 +100,6 @@ func connectLinux(ctx context.Context, creds Credentials) error { log.Info("Deleting FxBlox as connectToNetwork was successful") DeleteConnection(ctx, "FxBlox") - // Save connection properties - if err := config.WriteProperties(map[string]interface{}{ - "ssid": creds.SSID, - "password": creds.Password, - "connection": connectionName, - "country_code": creds.CountryCode, - }); err != nil { - log.Warnf("Couldn't write the properties file: %v", err) - } - return nil }