mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-02 19:05:32 -04:00
Show spinner and hide download button when posting to API
This commit is contained in:
parent
d9d1dbc26f
commit
1bbb08eede
@ -24,6 +24,8 @@ const download = () => {
|
|||||||
const selected = $('tbody > tr.ui-selected');
|
const selected = $('tbody > tr.ui-selected');
|
||||||
if (selected.length === 0) return;
|
if (selected.length === 0) return;
|
||||||
UIkit.modal.confirm(`Download ${selected.length} selected chapters?`).then(() => {
|
UIkit.modal.confirm(`Download ${selected.length} selected chapters?`).then(() => {
|
||||||
|
$('#download-btn').attr('hidden', '');
|
||||||
|
$('#download-spinner').removeAttr('hidden');
|
||||||
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();
|
||||||
@ -42,6 +44,10 @@ const download = () => {
|
|||||||
})
|
})
|
||||||
.fail((jqXHR, status) => {
|
.fail((jqXHR, status) => {
|
||||||
alert('danger', `Failed to add chapters to the download queue. Error: [${jqXHR.status}] ${jqXHR.statusText}`);
|
alert('danger', `Failed to add chapters to the download queue. Error: [${jqXHR.status}] ${jqXHR.statusText}`);
|
||||||
|
})
|
||||||
|
.always(() => {
|
||||||
|
$('#download-spinner').attr('hidden', '');
|
||||||
|
$('#download-btn').removeAttr('hidden');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user