Updates and more

This commit is contained in:
2023-11-12 22:43:42 +01:00
parent 7450ecdabb
commit 3889f28eb8
43 changed files with 5188 additions and 322 deletions

View File

@@ -1,5 +1,5 @@
import type {Server} from "../types/data.ts";
import {ServerSchema} from "../types/data.ts";
import type {Player, Server} from "../types/data.ts";
import {PlayerSchema, ServerSchema} from "../types/data.ts";
import {fetchWithToken} from "./repo.ts";
export class DataRepo {
@@ -8,4 +8,8 @@ export class DataRepo {
public async getServer(): Promise<Server> {
return await fetchWithToken(this.token, "/data/server").then(value => value.json()).then(value => ServerSchema.parse(value));
}
public async getMe(): Promise<Player> {
return await fetchWithToken(this.token, "/data/me").then(value => value.json()).then(value => PlayerSchema.parse(value));
}
}