Post selected chapter JSON object to API, instead of just posting the

IDs
This commit is contained in:
Alex Ling
2020-02-26 17:45:37 +00:00
parent c33884ea29
commit d9d1dbc26f
2 changed files with 11 additions and 4 deletions
+9 -3
View File
@@ -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) => {