Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Clear cache ajax fix

givanz3e0ec245e240
diff --git a/public/js/admin/controller/cache.js b/public/js/admin/controller/cache.js
index 2abf7f2..03ca9d8 100644
--- a/public/js/admin/controller/cache.js
+++ b/public/js/admin/controller/cache.js
@@ -1,9 +1,7 @@
class CacheController {
- clear(e) {
- let link = e.currentTarget;
- //let url = window.location.pathname + '?module=tools/cache&action=delete';
- let url = link.href;
+ clear(e, element) {
+ let url = element.href;
fetch(url)
.then((response) => {
@@ -11,12 +9,12 @@ class CacheController {
return response.text()
})
.then((data) => {
- let message = data.querySelector(".notifications .alert [data-v-notification-text]").innerHTML;
+ let response = new DOMParser().parseFromString(data, "text/html");
+ let message = response.querySelector(".notifications .alert [data-v-notification-text]")?.innerHTML;
displayToast("bg-success", "Cache", message, "top");
})
.catch(error => {
- let message = data.querySelector(".notifications .alert [data-v-notification-text]").innerHTML;
- displayToast("bg-danger", "Cache", message, "top");
+ displayToast("bg-danger", "Cache", "Error", "top");
//displayToast("bg-danger", "Error", "Error saving!");
});