Arduino switch state display in web page

Arduino side example. pumpAlarmReset and manualRun are commands from web page button send with javascript xmlhttprequest

void handleRestServer() {
  NetClient client = restServer.available();
  if (!client)
    return;
  if (client.connected()) {
    if (client.available()) {
      String s = client.readStringUntil('\n');
      client.flush();
      client.println(F("HTTP/1.1 200 OK"));
      client.println(F("Content-Type: application/json"));
      client.println(F("Connection: close"));
      client.println(F("Cache-Control: no-store"));
      client.println(F("Access-Control-Allow-Origin: *"));
      client.println();
      if (s.indexOf("events.json") != -1) {
        events.printJson(client);
      } else if (s.indexOf("alarm.json") != -1) {
        printAlarmJson(client);
      } else if (s.indexOf("pumpAlarmReset") != -1) {
        if (stopCause == AlarmCause::PUMP) {
          stopAlarm();
        }
      } else if (s.indexOf("manualRun") != -1) {
        manualRunRequest = true;
      } else if (s.indexOf("index.json") != -1) {
        printValuesJson(client);
      }
      client.flush();
    }
  }
  client.stop();
}