WordClockESP/lib/framework/RestartService.cpp
Rick Watson 78b9ae101e Add restart service for esp8266 and esp32
Add restart feature to status screen
Upgrade material-ui
Add icons to buttons
2019-11-30 12:34:52 +00:00

15 lines
453 B
C++

#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)
);
}
void RestartService::restart(AsyncWebServerRequest *request) {
request->onDisconnect([](){
ESP.restart();
});
request->send(200);
}