diff options
author | xengineering <me@xengineering.eu> | 2024-03-03 17:23:09 +0100 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2024-03-03 19:22:30 +0100 |
commit | fa4c7e7af50817bc895f56f3fa25b50b8444407d (patch) | |
tree | e2259b98bf0e48ce323ad1c6bea31cd78143c30f /view/static | |
parent | fc8160d4404f18042b7d265f2f595e4a3d75242b (diff) | |
download | ceres-fa4c7e7af50817bc895f56f3fa25b50b8444407d.tar ceres-fa4c7e7af50817bc895f56f3fa25b50b8444407d.tar.zst ceres-fa4c7e7af50817bc895f56f3fa25b50b8444407d.zip |
view: Add recipe create
Diffstat (limited to 'view/static')
-rw-r--r-- | view/static/ceres.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/view/static/ceres.js b/view/static/ceres.js index 3bfeb6c..2fff18c 100644 --- a/view/static/ceres.js +++ b/view/static/ceres.js @@ -31,6 +31,23 @@ function updateFormData(event) { }); } +function create(url) { + fetch(url, {method: 'POST'}) + .then(response => { + if (response.ok) { + console.log('Create successfully'); + } else { + console.error('Create failed'); + } + if (response.redirected) { + window.location.href = response.url; + } + }) + .catch(error => { + console.error('Network error:', error); + }); +} + function del(url) { fetch(url, {method: 'DELETE'}) .then(response => { |