summaryrefslogtreecommitdiff
path: root/view/static
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2024-03-03 17:23:09 +0100
committerxengineering <me@xengineering.eu>2024-03-03 19:22:30 +0100
commitfa4c7e7af50817bc895f56f3fa25b50b8444407d (patch)
treee2259b98bf0e48ce323ad1c6bea31cd78143c30f /view/static
parentfc8160d4404f18042b7d265f2f595e4a3d75242b (diff)
downloadceres-fa4c7e7af50817bc895f56f3fa25b50b8444407d.tar
ceres-fa4c7e7af50817bc895f56f3fa25b50b8444407d.tar.zst
ceres-fa4c7e7af50817bc895f56f3fa25b50b8444407d.zip
view: Add recipe create
Diffstat (limited to 'view/static')
-rw-r--r--view/static/ceres.js17
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 => {