mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 11:25:29 -04:00
Post selected chapter JSON object to API, instead of just posting the
IDs
This commit is contained in:
parent
c33884ea29
commit
d9d1dbc26f
@ -27,11 +27,17 @@ const download = () => {
|
|||||||
const ids = selected.map((i, e) => {
|
const ids = selected.map((i, e) => {
|
||||||
return $(e).find('td').first().text();
|
return $(e).find('td').first().text();
|
||||||
}).get();
|
}).get();
|
||||||
|
const chapters = globalChapters.filter(c => ids.indexOf(c.id));
|
||||||
console.log(ids);
|
console.log(ids);
|
||||||
$.post('/api/admin/download', {
|
$.ajax({
|
||||||
chapters: ids
|
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');
|
console.log('post succeed');
|
||||||
})
|
})
|
||||||
.fail((jqXHR, status) => {
|
.fail((jqXHR, status) => {
|
||||||
|
@ -53,7 +53,8 @@
|
|||||||
<div class="uk-margin">
|
<div class="uk-margin">
|
||||||
<button class="uk-button uk-button-default" onclick="selectAll()">Select All</button>
|
<button class="uk-button uk-button-default" onclick="selectAll()">Select All</button>
|
||||||
<button class="uk-button uk-button-default" onclick="unselect()">Clear Selections</button>
|
<button class="uk-button uk-button-default" onclick="unselect()">Clear Selections</button>
|
||||||
<button class="uk-button uk-button-primary" onclick="download()">Download Selected</button>
|
<button class="uk-button uk-button-primary" id="download-btn" onclick="download()">Download Selected</button>
|
||||||
|
<div id="download-spinner" uk-spinner class="uk-margin-left" hidden></div>
|
||||||
</div>
|
</div>
|
||||||
<p class="uk-text-meta">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.</p>
|
<p class="uk-text-meta">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.</p>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user