Only return the config for the created device on POST

This commit is contained in:
Daniel Lundin
2019-05-12 18:29:46 +02:00
parent 082a59de78
commit 80ac5bdd10
+7 -6
View File
@@ -411,16 +411,17 @@ func (s *Server) CreateDevice(w http.ResponseWriter, r *http.Request, ps httprou
log.Fatal(err)
}
err = json.NewEncoder(w).Encode(c)
err = s.configureWireguard()
if err != nil {
log.Error(err)
w.WriteHeader(http.StatusInternalServerError)
}
err = json.NewEncoder(w).Encode(device)
if err != nil {
log.Error(err)
w.WriteHeader(http.StatusInternalServerError)
return
}
err = s.configureWireguard()
if err != nil {
log.Error(err)
w.WriteHeader(http.StatusInternalServerError)
}
}