From 28abf579e8a54affa8f640fb1b9084eeec91642d Mon Sep 17 00:00:00 2001 From: proddy Date: Thu, 13 Jun 2024 21:11:49 +0200 Subject: [PATCH] process all modules before showing error --- src/web/WebModulesService.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/web/WebModulesService.cpp b/src/web/WebModulesService.cpp index c9a673311..806302f65 100644 --- a/src/web/WebModulesService.cpp +++ b/src/web/WebModulesService.cpp @@ -74,19 +74,18 @@ void WebModules::read(WebModules & webModules, JsonObject root) { // and then apply the enable/disable that is set by the user // This function is called when ems-esp boots and also on a save from the Modules web page StateUpdateResult WebModules::update(JsonObject root, WebModules & webModules) { + bool err = false; if (root["modules"].is()) { for (const JsonObject module : root["modules"].as()) { auto key = module["key"].as(); auto license = module["license"].as(); auto enable = module["enabled"].as(); - if (!moduleLibrary.enable(key, license, enable)) { - return StateUpdateResult::ERROR; // throw a 400 error - } + err &= moduleLibrary.enable(key, license, enable); } } - return StateUpdateResult::CHANGED; + return err ? StateUpdateResult::ERROR : StateUpdateResult::CHANGED; } } // namespace emsesp