summary refs log tree commit diff
path: root/v2/client.ts
blob: eedc578f9459bcd8eaac390e223668e0609be76e (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
29
30
31
import { Screen } from "./screen.ts";

export let token: string;
export let account;

let screen: Screen;

export function setScreen(screenN: Screen) {
    screen = screenN
}

export async function login(username: string, password: string) {
    const authr = await (await fetch("https://api.meower.org/auth/login", {
        method: "post",
        headers: {
            "content-type": "application/json"
        },
        body: JSON.stringify({
            username,
            password
        })
    })).json();

    token = authr.token;
    account = authr.account
}

export async function loadHome() {
    const home = (await (await fetch("https://api.meower.org/home")).json()).autoget;
    
}