♻️ Replaces JsonObject with JsonVariant

This commit is contained in:
Rune Harlyk
2025-07-10 17:34:52 +02:00
committed by Rune Harlyk
parent 144b99c180
commit e3cfe89e19
19 changed files with 75 additions and 79 deletions
@@ -21,9 +21,7 @@ class StatefulHttpEndpoint {
: _stateReader(stateReader), _stateUpdater(stateUpdater), _statefulService(statefulService) {}
esp_err_t handleStateUpdate(PsychicRequest *request, JsonVariant &json) {
if (!json.is<JsonObject>()) return request->reply(400);
JsonObject jsonObject = json.as<JsonObject>();
JsonVariant jsonObject = json.as<JsonVariant>();
StateUpdateResult outcome = _statefulService->updateWithoutPropagation(jsonObject, _stateUpdater);
if (outcome == StateUpdateResult::ERROR)
@@ -43,7 +41,7 @@ class StatefulHttpEndpoint {
esp_err_t getState(PsychicRequest *request) {
PsychicJsonResponse response = PsychicJsonResponse(request, false);
JsonObject jsonObject = response.getRoot();
JsonVariant jsonObject = response.getRoot();
_statefulService->read(jsonObject, _stateReader);
return response.send();
}