This commit is contained in:
rngsurrounded
2025-03-04 01:21:57 +09:00
parent 325ca97fd3
commit 085d3bb912
3 changed files with 16 additions and 7 deletions
@@ -1,5 +1,5 @@
import { userFetch } from ".";
import { Competition } from "../types/competition";
import { Competition, CompetitionResult } from "../types/competition";
export const getCompetitions = async (participating?: boolean) => {
return await userFetch<Competition[]>("/competitions", {
@@ -13,6 +13,10 @@ export const getCompetition = async (id: string) => {
return await userFetch<Competition>(`/competitions/${id}`);
};
export const getCompetitionResults = async (id: string) => {
return await userFetch<CompetitionResult>(`/competitions/${id}/results`);
}
export const startCompetition = async (competitionId: string) => {
return await userFetch(`/competitions/${competitionId}/start`, {
method: "POST",
@@ -24,3 +24,8 @@ export enum CompetitionType {
export enum CompetitionParticipationType {
SOLO = "solo",
}
export interface CompetitionResult {
task_name: string;
result: number;
}