Use auto keyword and references more often

This commit is contained in:
Thomas Basler
2024-01-04 15:38:56 +01:00
parent b0b9764a23
commit 3c37b61f44
18 changed files with 48 additions and 48 deletions

View File

@@ -33,7 +33,7 @@ void WebApiMqttClass::onMqttStatus(AsyncWebServerRequest* request)
}
AsyncJsonResponse* response = new AsyncJsonResponse(false, MQTT_JSON_DOC_SIZE);
JsonObject root = response->getRoot();
auto& root = response->getRoot();
const CONFIG_T& config = Configuration.get();
root["mqtt_enabled"] = config.Mqtt.Enabled;
@@ -67,7 +67,7 @@ void WebApiMqttClass::onMqttAdminGet(AsyncWebServerRequest* request)
}
AsyncJsonResponse* response = new AsyncJsonResponse(false, MQTT_JSON_DOC_SIZE);
JsonObject root = response->getRoot();
auto& root = response->getRoot();
const CONFIG_T& config = Configuration.get();
root["mqtt_enabled"] = config.Mqtt.Enabled;
@@ -105,7 +105,7 @@ void WebApiMqttClass::onMqttAdminPost(AsyncWebServerRequest* request)
}
AsyncJsonResponse* response = new AsyncJsonResponse(false, MQTT_JSON_DOC_SIZE);
JsonObject retMsg = response->getRoot();
auto& retMsg = response->getRoot();
retMsg["type"] = "warning";
if (!request->hasParam("data", true)) {