Fork of the excellent esp8266-react - https://github.com/rjwats/esp8266-react
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

18 lines
510 B

#include <ResetService.h>
ResetService::ResetService(AsyncWebServer* server, SecurityManager* securityManager) {
server->on(RESET_SERVICE_PATH, HTTP_POST, securityManager->wrapRequest(
std::bind(&ResetService::reset, this, std::placeholders::_1), AuthenticationPredicates::IS_ADMIN
));
}
void ResetService::reset(AsyncWebServerRequest* request) {
request->onDisconnect([]() {
#if defined(ESP8266)
ESP.reset();
#elif defined(ESP_PLATFORM)
ESP.restart();
#endif
});
request->send(200);
}