New Dashboard
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
import type {Player, Server} from "@type/data.ts";
|
||||
import {PlayerSchema, ServerSchema} from "@type/data.ts";
|
||||
import {fetchWithToken, tokenStore} from "./repo.ts";
|
||||
import {derived} from "svelte/store";
|
||||
import {derived, get} from "svelte/store";
|
||||
|
||||
export class DataRepo {
|
||||
constructor(private token: string) {
|
||||
@@ -33,6 +33,10 @@ export class DataRepo {
|
||||
public async getMe(): Promise<Player> {
|
||||
return await fetchWithToken(this.token, "/data/me").then(value => value.json()).then(PlayerSchema.parse);
|
||||
}
|
||||
|
||||
public async getPlayers(): Promise<Player[]> {
|
||||
return await fetchWithToken(get(tokenStore), "/data/admin/users").then(value => value.json()).then(PlayerSchema.array().parse);
|
||||
}
|
||||
}
|
||||
|
||||
export const dataRepo = derived(tokenStore, ($token) => new DataRepo($token));
|
||||
@@ -31,15 +31,15 @@ export interface CreateEvent {
|
||||
}
|
||||
|
||||
export interface UpdateEvent {
|
||||
name: string | null;
|
||||
start: Dayjs | null;
|
||||
end: Dayjs | null;
|
||||
deadline: Dayjs | null;
|
||||
maxTeamMembers: number | null;
|
||||
schemType: string | null;
|
||||
publicSchemsOnly: boolean | null;
|
||||
addReferee: string[] | null;
|
||||
removeReferee: string[] | null;
|
||||
name?: string | null;
|
||||
start?: Dayjs | number | null;
|
||||
end?: Dayjs | number | null;
|
||||
deadline?: Dayjs | number | null;
|
||||
maxTeamMembers?: number | null;
|
||||
schemType?: string | null;
|
||||
publicSchemsOnly?: boolean | null;
|
||||
addReferee?: string[] | null;
|
||||
removeReferee?: string[] | null;
|
||||
}
|
||||
|
||||
export class EventRepo {
|
||||
|
||||
Reference in New Issue
Block a user