From ea598020c8456323d3ce50a539874b61d3186925 Mon Sep 17 00:00:00 2001 From: Diego Vazquez Date: Fri, 7 Jul 2017 23:25:34 -0300 Subject: [PATCH] Fix Delete --- TempXD/data/tempxd.js | 4 ++-- TempXD/webServer.h | 15 +++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/TempXD/data/tempxd.js b/TempXD/data/tempxd.js index d662243..3d42723 100644 --- a/TempXD/data/tempxd.js +++ b/TempXD/data/tempxd.js @@ -30,7 +30,7 @@ function updateFileList(){ function recordDelete() { file = fileName.substring(5); - $.get("recordDelete.json??name=" + file.substring(0,file.length - 4) +"&random=" + Math.random(), function(data) { + $.get("recordDelete.json?name=" + file.substring(0,file.length - 4) +"&random=" + Math.random(), function(data) { location.reload(); }); } @@ -85,7 +85,7 @@ function getData() { /* --------------- */ function getDataPointsFromCSV(csv) { - var dataPoints = csvLines = points = []; + var dataPoints = dataPoints1 = dataPoints2 = csvLines = points = []; var yearmontday = []; var hourminsec = []; csvLines = csv.split(/[\r?\n|\r|\n]+/); diff --git a/TempXD/webServer.h b/TempXD/webServer.h index 044acf3..0817fb1 100644 --- a/TempXD/webServer.h +++ b/TempXD/webServer.h @@ -19,14 +19,13 @@ void webServerStart() { // Delete file server.on("/recordDelete.json", HTTP_GET, [](AsyncWebServerRequest *request){ String name = "nope"; - int params = request->params(); - for(int i=0;igetParam(i); - if ( p->name().c_str() == "name" ) { - String name = p->value().c_str(); - }; - }; - SPIFFS.remove("/req/" + name + ".json" ); + if(request->hasParam("name")) + { + AsyncWebParameter* p = request->getParam("name"); + name = p->value().c_str(); + } + SPIFFS.remove("/req/" + name + ".csv" ); + Serial.println("Deleting /req/" + name + ".csv"); request->send(200, "application/json", "{ \"delete\" : true }" ); });