From ceae8082d6f34d7bb190fad9763ba3cb78742370 Mon Sep 17 00:00:00 2001 From: bruno Date: Thu, 25 Apr 2024 15:05:03 +0200 Subject: [PATCH] Test file list --- assets/script.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/assets/script.js b/assets/script.js index f5a5bd3..19423c9 100644 --- a/assets/script.js +++ b/assets/script.js @@ -563,7 +563,7 @@ function uploadFile() { xhr.send(formData); } -function deleteFile(fileID){ +function deleteFile(fileID) { let formData = new FormData(); formData.append('action', 'deleteFile'); formData.append('file_id', fileID); @@ -582,9 +582,13 @@ async function listFiles() { xhr.onload = function () { if (xhr.status === 200) { - displayList(xhr.responseText, "filelist", deleteFile); + const resp = JSON.parse(xhr.responseText); + if (resp.Status == "Success") { + displayList(resp['Files'], "filelist", deleteFile); + } } - }; + } +}; - xhr.send(formData); +xhr.send(formData); } \ No newline at end of file