From 1e2f941f47c15093fc37109d1042e965ac3b3b04 Mon Sep 17 00:00:00 2001 From: lexx Date: Wed, 6 May 2026 23:28:23 +0300 Subject: [PATCH] cleanup --- front/js/htmx-form.js | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 front/js/htmx-form.js diff --git a/front/js/htmx-form.js b/front/js/htmx-form.js deleted file mode 100644 index d0d265b..0000000 --- a/front/js/htmx-form.js +++ /dev/null @@ -1,24 +0,0 @@ -export function loadHtmxFormsBehaviour(){ - document.querySelectorAll(".form").forEach(el => { - initHtmxForm(el); - }) - -} - -function initHtmxForm(el){ - el.addEventListener("htmx:responseError", (e) => { - el.querySelector(".form-errors").innerHTML = e.detail.xhr.response; - }); - - const formEl = el.querySelector("form"); - - if(!formEl.getAttribute("hx-redirect")){ - return; - } - el.addEventListener("htmx:afterOnLoad", (e) => { - if(e.detail.successful){ - return window.location.href = formEl.getAttribute("hx-redirect"); - } - }); - -}