Files
EMS-ESP32/lib/framework/RestartService.cpp
2021-03-28 21:35:30 +02:00

13 lines
484 B
C++

#include <RestartService.h>
using namespace std::placeholders; // for `_1` etc
RestartService::RestartService(AsyncWebServer * server, SecurityManager * securityManager) {
server->on(RESTART_SERVICE_PATH, HTTP_POST, securityManager->wrapRequest(std::bind(&RestartService::restart, this, _1), AuthenticationPredicates::IS_ADMIN));
}
void RestartService::restart(AsyncWebServerRequest * request) {
request->onDisconnect(RestartService::restartNow);
request->send(200);
}