about summary refs log tree commit diff
path: root/kittybox-rs/companion-lite/micropub_api.js
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2022-09-29 22:39:28 +0300
committerVika <vika@fireburn.ru>2022-09-29 22:39:28 +0300
commitb7d4e5c4686bc8aac41d832567190002542a1743 (patch)
tree6a42a990fbb06057a64de5f68175f94c3637c2c7 /kittybox-rs/companion-lite/micropub_api.js
parentb3508ccb146648950ed392b517d12354203c4347 (diff)
companion-lite: port to TypeScript
Diffstat (limited to 'kittybox-rs/companion-lite/micropub_api.js')
-rw-r--r--kittybox-rs/companion-lite/micropub_api.js43
1 files changed, 0 insertions, 43 deletions
diff --git a/kittybox-rs/companion-lite/micropub_api.js b/kittybox-rs/companion-lite/micropub_api.js
deleted file mode 100644
index 402c075..0000000
--- a/kittybox-rs/companion-lite/micropub_api.js
+++ /dev/null
@@ -1,43 +0,0 @@
-export async function query_channels(endpoint, token) {
-    const response = await fetch(endpoint + "?q=config", {
-        headers: {
-            "Authorization": `Bearer ${get_token()}`
-        }
-    })
-
-    const config = await response.json();
-
-    return config["channels"]
-}
-
-export async function submit(endpoint, token, mf2) {
-    try {
-        const response = await fetch(endpoint, {
-            method: "POST",
-            headers: {
-                "Authorization": `Bearer ${token}`,
-                "Content-Type": "application/json"
-            },
-            body: JSON.stringify(mf2)
-        })
-
-
-        if (response.status != 201 || response.status != 202) {
-            let err = await response.json();
-            console.error("Micropub error!", err);
-            
-            return err;
-        } else {
-            return {
-                "location": response.headers.get("Location")
-            }
-        }
-    } catch (e) {
-        console.error("Network error!", e)
-        throw e
-    }
-}
-
-// Local Variables:
-// js-indent-level: 4
-// End: