feat: add double elimination match mode
This commit is contained in:
1 parent
b9aaf55193
commit
e12f182e7f
19 files changed
+3415
-58
No files matched your search
@@ -310,6 +310,101 @@ export function useUpdateMatch(communityId = DEFAULT_COMMUNITY_ID) {
|
||||
});
|
||||
}
|
||||
|
||||
export function useReshuffleDoubleEliminationSeeds(
|
||||
communityId = DEFAULT_COMMUNITY_ID,
|
||||
) {
|
||||
return useMutation({
|
||||
mutationFn: (matchId: string) =>
|
||||
apiFetch<ApiMatch>(
|
||||
`/communities/${communityId}/matches/${matchId}/double-elimination/seeds/reshuffle`,
|
||||
{ method: 'POST' },
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
export function useSwapDoubleEliminationSeeds(
|
||||
communityId = DEFAULT_COMMUNITY_ID,
|
||||
) {
|
||||
return useMutation({
|
||||
mutationFn: (params: {
|
||||
matchId: string;
|
||||
leftSeedNumber: number;
|
||||
rightSeedNumber: number;
|
||||
}) =>
|
||||
apiFetch<ApiMatch>(
|
||||
`/communities/${communityId}/matches/${params.matchId}/double-elimination/seeds/swap`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
leftSeedNumber: params.leftSeedNumber,
|
||||
rightSeedNumber: params.rightSeedNumber,
|
||||
}),
|
||||
},
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
export function useApplyDoubleEliminationWalkover(
|
||||
communityId = DEFAULT_COMMUNITY_ID,
|
||||
) {
|
||||
return useMutation({
|
||||
mutationFn: (params: {
|
||||
matchId: string;
|
||||
bracketMatchId: string;
|
||||
winnerTeamIndex: number;
|
||||
reason?: string;
|
||||
}) =>
|
||||
apiFetch<ApiMatch>(
|
||||
`/communities/${communityId}/matches/${params.matchId}/double-elimination/bracket-matches/${params.bracketMatchId}/walkover`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
winnerTeamIndex: params.winnerTeamIndex,
|
||||
reason: params.reason,
|
||||
}),
|
||||
},
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
export function useCancelDoubleEliminationWalkover(
|
||||
communityId = DEFAULT_COMMUNITY_ID,
|
||||
) {
|
||||
return useMutation({
|
||||
mutationFn: (params: {
|
||||
matchId: string;
|
||||
bracketMatchId: string;
|
||||
reason?: string;
|
||||
}) =>
|
||||
apiFetch<ApiMatch>(
|
||||
`/communities/${communityId}/matches/${params.matchId}/double-elimination/bracket-matches/${params.bracketMatchId}/walkover/cancel`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ reason: params.reason }),
|
||||
},
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
export function useCancelDoubleEliminationRiotResult(
|
||||
communityId = DEFAULT_COMMUNITY_ID,
|
||||
) {
|
||||
return useMutation({
|
||||
mutationFn: (params: {
|
||||
matchId: string;
|
||||
bracketMatchId: string;
|
||||
reason?: string;
|
||||
}) =>
|
||||
apiFetch<ApiMatch>(
|
||||
`/communities/${communityId}/matches/${params.matchId}/double-elimination/bracket-matches/${params.bracketMatchId}/result/cancel`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ reason: params.reason }),
|
||||
},
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
function createUserHistoryPath(
|
||||
communityId: string,
|
||||
userId: string,
|
||||
|
||||
Reference in new issue
Block a user