From 2a59fad2fcf88f0f689ac68e3620603eec079b3d Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Fri, 31 Mar 2023 09:21:52 +0200 Subject: [PATCH] CMS loading speedup --- public/js/apps/Cis/Cms.js | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/public/js/apps/Cis/Cms.js b/public/js/apps/Cis/Cms.js index c28f96049..8f006ec27 100644 --- a/public/js/apps/Cis/Cms.js +++ b/public/js/apps/Cis/Cms.js @@ -1,23 +1,20 @@ import BsConfirm from "../../components/Bootstrap/Confirm.js"; Vue.createApp({ - components: { - BsConfirm - }, - mounted() { - document.querySelectorAll('#cms [data-confirm]').forEach(el => { - el.addEventListener('click', evt => { - evt.preventDefault(); - BsConfirm.popup(el.dataset.confirm).then(() => { - Axios.get(el.href).then(res => { - // TODO(chris): check for success then show message and/or reload - location = location; - }).catch(err => console.error('ERROR:', err)); - }).catch(()=>{}); - }); - }); - document.querySelectorAll('#cms [data-href]').forEach(el => { - el.href = el.dataset.href.replace(/^ROOT\//, FHC_JS_DATA_STORAGE_OBJECT.app_root); - }); - } -}).mount('#cms'); \ No newline at end of file + mounted() { + document.querySelectorAll('#cms [data-confirm]').forEach(el => { + el.addEventListener('click', evt => { + evt.preventDefault(); + BsConfirm.popup(el.dataset.confirm).then(() => { + Axios.get(el.href).then(res => { + // TODO(chris): check for success then show message and/or reload + location = location; + }).catch(err => console.error('ERROR:', err)); + }).catch(()=>{}); + }); + }); + document.querySelectorAll('#cms [data-href]').forEach(el => { + el.href = el.dataset.href.replace(/^ROOT\//, FHC_JS_DATA_STORAGE_OBJECT.app_root); + }); + } +}).mount('#cms [data-confirm], #cms [data-href]');