esp8266-react-framework/lib/framework/RestartService.cpp

14 lines
510 B
C++
Raw Normal View History

2019-12-01 08:28:40 +00:00
#include <RestartService.h>
RestartService::RestartService(AsyncWebServer* server, SecurityManager* securityManager) {
server->on(RESTART_SERVICE_PATH,
HTTP_POST,
securityManager->wrapRequest(std::bind(&RestartService::restart, this, std::placeholders::_1),
AuthenticationPredicates::IS_ADMIN));
2019-12-01 08:28:40 +00:00
}
void RestartService::restart(AsyncWebServerRequest* request) {
request->onDisconnect(RestartService::restartNow);
2019-12-01 08:28:40 +00:00
request->send(200);
}