Ver código fonte

add delete img api into removeImgData function

weichen 4 anos atrás
pai
commit
3cfe9be981
1 arquivos alterados com 4 adições e 2 exclusões
  1. 4 2
      backstage/static/js/utils.js

+ 4 - 2
backstage/static/js/utils.js

@@ -7,7 +7,9 @@ function removeImgElement(img, input, widthInput, heightInput, inputButton, remo
   removeButton.remove();
 }
 
-function removeImgData(blockArray, blockIndex, dataIndex) {
-  blockArray[blockIndex].data.splice(dataIndex, 1);
+function removeImgData(blockArray, blockIndex, dataIndex, contentUrl) {
+  const removeData = blockArray[blockIndex].data.splice(dataIndex, 1);
+  const filename = _.get(removeData, '0.image.src').replace('img/', '')
+  axios.delete(`${PORTAL_SERVER}delete/img?url=${contentUrl}&filename=${filename}`)
   return blockArray;
 }