aboutsummaryrefslogtreecommitdiff
path: root/static/api/rest.js
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2026-05-20 10:16:50 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2026-05-20 10:16:50 +0200
commit44445734ba4a0f05564f808c2fd34a7f23c6fafb (patch)
tree3bd22add718620cbf931286f55137bcc666100be /static/api/rest.js
parent95ae9f15e1db335a7f8358d811ea37e2c89dd10f (diff)
Let's do a rewrite!
Created project structure and changed `build.zig` and added licence.
Diffstat (limited to 'static/api/rest.js')
-rw-r--r--static/api/rest.js22
1 files changed, 0 insertions, 22 deletions
diff --git a/static/api/rest.js b/static/api/rest.js
deleted file mode 100644
index 6b14034..0000000
--- a/static/api/rest.js
+++ /dev/null
@@ -1,22 +0,0 @@
-
-async function handle_fetch(promise) {
- const result = await promise;
- const json = await result.json();
-
- if (!result.ok) {
- throw json;
- }
-
- return json;
-}
-
-export function get(url) {
- return handle_fetch(fetch(url));
-}
-
-export function post(url, body) {
- return handle_fetch(fetch(url, {
- method: 'POST',
- body: JSON.stringify(body),
- }));
-}