Skip to content

Commit

Permalink
Fix Delete
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego Vazquez committed Jul 8, 2017
1 parent 8673116 commit ea59802
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions TempXD/data/tempxd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}
Expand Down Expand Up @@ -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]+/);
Expand Down
15 changes: 7 additions & 8 deletions TempXD/webServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;i<params;i++){
AsyncWebParameter* p = request->getParam(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 }" );
});

Expand Down

0 comments on commit ea59802

Please sign in to comment.