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