diff options
Diffstat (limited to 'frontend/adminpanel.ts')
-rw-r--r-- | frontend/adminpanel.ts | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/frontend/adminpanel.ts b/frontend/adminpanel.ts new file mode 100644 index 0000000..aef7a31 --- /dev/null +++ b/frontend/adminpanel.ts @@ -0,0 +1,28 @@ +import { e } from "./helper.ts" + +let user: string | undefined = undefined +let pw: string | undefined = undefined + +interface PendingBang { + bang: string, + name: string, + url: string, + email: string | undefined, +} + +export async function tryLoadAdminPanel(user_: string, pw_: string) { + user = user_ + pw = pw_ + + const r = await fetch("/pendingBangs", { + headers: { + Accept: "application/json", + Authorization: "Basic " + btoa(`${user}:${pw}`), + } + }) + if (!r.ok) + throw (await r.json()).message + + const pending = await r.json() as PendingBang[] + console.log(pending) +} |