aboutsummaryrefslogtreecommitdiff
path: root/frontend/adminpanel.ts
blob: aef7a3160cdc37aa010f732244c27f1a60640d0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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)
}