Merge branch 'master' of gitlab.prodcontest.ru:team-15/project

This commit is contained in:
moolcoov
2025-03-03 20:36:12 +03:00
17 changed files with 682 additions and 130 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,9 @@ export enum CompetitionType {
export enum CompetitionParticipationType {
SOLO = "solo",
}
export interface CompetitionResult {
task_name: string;
result: number;
max_points: number;
}