diff options
author | xengineering <me@xengineering.eu> | 2024-03-17 20:14:35 +0100 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2024-03-24 10:10:54 +0100 |
commit | f4edf94a7bcf94d34eaf91397e3c0eeefec0cc8b (patch) | |
tree | 5f898ec6bcc8560f5edbbc9eed2486b402dc5df1 /view/static | |
parent | 40a576737de18af2fb20387b3b76b12053910fe9 (diff) | |
download | ceres-f4edf94a7bcf94d34eaf91397e3c0eeefec0cc8b.tar ceres-f4edf94a7bcf94d34eaf91397e3c0eeefec0cc8b.tar.zst ceres-f4edf94a7bcf94d34eaf91397e3c0eeefec0cc8b.zip |
view: Add editing of existing recipe steps
Diffstat (limited to 'view/static')
-rw-r--r-- | view/static/ceres.js | 33 |
1 files changed, 0 insertions, 33 deletions
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 => { |