diff options
| author | Fuwn <[email protected]> | 2022-09-21 18:29:52 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-09-21 18:29:52 -0700 |
| commit | 7051213e0fdbd47ab1c0e6e8a67bda4f9cfba323 (patch) | |
| tree | a0a59d1bf0b800635eb988a8c030cc0b0ed7c7fe /backup/todos/api.ts | |
| download | capybara-markets-7051213e0fdbd47ab1c0e6e8a67bda4f9cfba323.tar.xz capybara-markets-7051213e0fdbd47ab1c0e6e8a67bda4f9cfba323.zip | |
feat: initial commit
Diffstat (limited to 'backup/todos/api.ts')
| -rw-r--r-- | backup/todos/api.ts | 20 |
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) + }); +} |