From 22a2150eef88430f9d9d5491a002e23e7813ac0c Mon Sep 17 00:00:00 2001 From: wlodekm Date: Sat, 9 Nov 2024 16:37:43 +0200 Subject: v2 progress --- v2/client.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 v2/client.ts (limited to 'v2/client.ts') diff --git a/v2/client.ts b/v2/client.ts new file mode 100644 index 0000000..eedc578 --- /dev/null +++ b/v2/client.ts @@ -0,0 +1,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; + +} \ No newline at end of file -- cgit 1.4.1-2-gfad0