Updates and more
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user