diff options
author | wlodekm <[email protected]> | 2024-11-09 16:37:43 +0200 |
---|---|---|
committer | wlodekm <[email protected]> | 2024-11-09 16:37:43 +0200 |
commit | 22a2150eef88430f9d9d5491a002e23e7813ac0c (patch) | |
tree | 16e275e98e7a358f617a5404230e894db267eee1 /v2/client.ts | |
parent | 12617679441c80cb827cb486e269b56c14b055f4 (diff) |
v2 progress
Diffstat (limited to 'v2/client.ts')
-rw-r--r-- | v2/client.ts | 31 |
1 files changed, 31 insertions, 0 deletions
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 |