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.

13 lines
507 B

  1. #include <RestartService.h>
  2. RestartService::RestartService(AsyncWebServer* server, SecurityManager* securityManager) {
  3. server->on(RESTART_SERVICE_PATH,
  4. HTTP_POST,
  5. securityManager->wrapRequest(std::bind(&RestartService::restart, this, std::placeholders::_1),
  6. AuthenticationPredicates::IS_ADMIN));
  7. }
  8. void RestartService::restart(AsyncWebServerRequest* request) {
  9. request->onDisconnect([]() { ESP.restart(); });
  10. request->send(200);
  11. }