]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - assets/common/js/thumbnails-update.js
Process thumbnail synchronize page through Slim controllers
[github/shaarli/Shaarli.git] / assets / common / js / thumbnails-update.js
index b37a32f307e427f1a5941c994406b4945a7bd27f..3cd4c2a761f778989e682ee181421200abe012cc 100644 (file)
@@ -17,7 +17,7 @@
  */
 function updateThumb(basePath, ids, i, elements) {
   const xhr = new XMLHttpRequest();
-  xhr.open('POST', `${basePath}/?do=ajax_thumb_update`);
+  xhr.open('PATCH', `${basePath}/admin/shaare/${ids[i]}/update-thumbnail`);
   xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
   xhr.responseType = 'json';
   xhr.onload = () => {
@@ -30,14 +30,14 @@ function updateThumb(basePath, ids, i, elements) {
       elements.current.innerHTML = i;
       elements.title.innerHTML = response.title;
       if (response.thumbnail !== false) {
-        elements.thumbnail.innerHTML = `<img src="${response.thumbnail}">`;
+        elements.thumbnail.innerHTML = `<img src="${basePath}/${response.thumbnail}">`;
       }
       if (i < ids.length) {
         updateThumb(basePath, ids, i, elements);
       }
     }
   };
-  xhr.send(`id=${ids[i]}`);
+  xhr.send();
 }
 
 (() => {