]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - assets/common/js/shaare-batch.js
Merge pull request #1694 from ArthurHoaro/fix/bulk-add-redirect-token
[github/shaarli/Shaarli.git] / assets / common / js / shaare-batch.js
index 9753137ddf51a9558c26f95ecd4d576bebe647c2..6fc16faf1e732d4326411a3458087d9da2d3d5b1 100644 (file)
@@ -30,9 +30,9 @@ const sendBookmarkForm = (basePath, formElement) => {
 const sendBookmarkDelete = (buttonElement, formElement) => (
   new Promise((resolve, reject) => {
     const xhr = new XMLHttpRequest();
-    xhr.open('GET', buttonElement.href);
+    xhr.open('GET', `${buttonElement.href}&source=batch`);
     xhr.onload = () => {
-      if (xhr.status !== 200) {
+      if (xhr.status !== 204) {
         alert(`An error occurred. Return code: ${xhr.status}`);
         reject();
       } else {
@@ -104,7 +104,7 @@ const redirectIfEmptyBatch = (basePath, formElements, path) => {
         });
 
         Promise.all(promises).then(() => {
-          window.location.href = basePath || '/';
+          window.location.href = `${basePath}/`;
         });
       });
     });