From d9d1dbc26f179760884c3a99333dbeacb8663c92 Mon Sep 17 00:00:00 2001 From: Alex Ling Date: Wed, 26 Feb 2020 17:45:37 +0000 Subject: [PATCH] Post selected chapter JSON object to API, instead of just posting the IDs --- public/js/download.js | 12 +++++++++--- src/views/download.ecr | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/public/js/download.js b/public/js/download.js index e3cbb95..4473778 100644 --- a/public/js/download.js +++ b/public/js/download.js @@ -27,11 +27,17 @@ const download = () => { const ids = selected.map((i, e) => { return $(e).find('td').first().text(); }).get(); + const chapters = globalChapters.filter(c => ids.indexOf(c.id)); console.log(ids); - $.post('/api/admin/download', { - chapters: ids + $.ajax({ + type: 'POST', + url: '/api/admin/mangadex/download', + data: JSON.stringify({chapters: chapters}), + contentType: "application/json", + dataType: 'json' }) - .done(() => { + .done(data => { + console.log(data); console.log('post succeed'); }) .fail((jqXHR, status) => { diff --git a/src/views/download.ecr b/src/views/download.ecr index 95877dd..0ee3665 100644 --- a/src/views/download.ecr +++ b/src/views/download.ecr @@ -53,7 +53,8 @@
- + +

Click on a table row to select the chapter. Drag your mouse over multiple rows to select them all. Hold Ctrl to make multiple non-adjacent selections.