From f4edf94a7bcf94d34eaf91397e3c0eeefec0cc8b Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 17 Mar 2024 20:14:35 +0100 Subject: view: Add editing of existing recipe steps --- view/static/ceres.js | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'view/static') diff --git a/view/static/ceres.js b/view/static/ceres.js index 2fff18c..a8326da 100644 --- a/view/static/ceres.js +++ b/view/static/ceres.js @@ -1,36 +1,3 @@ -var forms = document.querySelectorAll('form'); -forms.forEach(form => { - form.addEventListener('submit', updateFormData); -}); - -function updateFormData(event) { - event.preventDefault(); - - const form = event.target; - const url = form.getAttribute('action'); - const data = new FormData(form); - const obj = Object.fromEntries(data.entries()); - - fetch(url, { - method: 'POST', - headers: {'Content-Type': 'application/json'}, - body: JSON.stringify(obj) - }) - .then(response => { - if (response.ok) { - console.log('Form submitted successfully'); - } else { - console.error('Form submission failed'); - } - if (response.redirected) { - window.location.href = response.url; - } - }) - .catch(error => { - console.error('Network error:', error); - }); -} - function create(url) { fetch(url, {method: 'POST'}) .then(response => { -- cgit v1.2.3-70-g09d2