From fecb96c91bbe715283ad323897e9b4088618c0d3 Mon Sep 17 00:00:00 2001 From: Alex Ling Date: Mon, 2 Mar 2020 02:10:01 +0000 Subject: [PATCH] Redirect to the download manager after adding jobs to the queue --- public/js/download.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/js/download.js b/public/js/download.js index 252254e..ee28255 100644 --- a/public/js/download.js +++ b/public/js/download.js @@ -40,7 +40,15 @@ const download = () => { }) .done(data => { console.log(data); - console.log('post succeed'); + if (data.error) { + alert('danger', `Failed to add chapters to the download queue. Error: ${data.error}`); + return; + } + const successCount = parseInt(data.success); + const failCount = parseInt(data.fail); + UIkit.modal.confirm(`${successCount} of ${successCount + failCount} chapters added to the download queue. Proceed to the download manager?`).then(() => { + window.location.href = '/admin/downloads'; + }); }) .fail((jqXHR, status) => { alert('danger', `Failed to add chapters to the download queue. Error: [${jqXHR.status}] ${jqXHR.statusText}`);