aboutsummaryrefslogtreecommitdiff
path: root/backup/todos/api.ts
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-09-21 18:29:52 -0700
committerFuwn <[email protected]>2022-09-21 18:29:52 -0700
commit7051213e0fdbd47ab1c0e6e8a67bda4f9cfba323 (patch)
treea0a59d1bf0b800635eb988a8c030cc0b0ed7c7fe /backup/todos/api.ts
downloadcapybara-markets-7051213e0fdbd47ab1c0e6e8a67bda4f9cfba323.tar.xz
capybara-markets-7051213e0fdbd47ab1c0e6e8a67bda4f9cfba323.zip
feat: initial commit
Diffstat (limited to 'backup/todos/api.ts')
-rw-r--r--backup/todos/api.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/backup/todos/api.ts b/backup/todos/api.ts
new file mode 100644
index 0000000..8344488
--- /dev/null
+++ b/backup/todos/api.ts
@@ -0,0 +1,20 @@
+/*
+ This module is used by the /todos endpoint to
+ make calls to api.svelte.dev, which stores todos
+ for each user.
+
+ (The data on the todo app will expire periodically; no
+ guarantees are made. Don't use it to organise your life.)
+*/
+
+const base = 'https://api.svelte.dev';
+
+export function api(method: string, resource: string, data?: Record<string, unknown>) {
+ return fetch(`${base}/${resource}`, {
+ method,
+ headers: {
+ 'content-type': 'application/json'
+ },
+ body: data && JSON.stringify(data)
+ });
+}