Change rematch event to change game

This commit is contained in:
2025-12-15 23:50:37 +07:00
parent 07e02ce32d
commit 339a212e57
14 changed files with 428 additions and 257 deletions

View File

@@ -1,5 +1,5 @@
import client from './client'
import type { ActiveEvent, MarathonEvent, EventCreate, DroppedAssignment, SwapCandidate, SwapRequestItem, MySwapRequests, CommonEnemyLeaderboardEntry, EventAssignment, CompleteResult } from '@/types'
import type { ActiveEvent, MarathonEvent, EventCreate, SwapCandidate, SwapRequestItem, MySwapRequests, CommonEnemyLeaderboardEntry, EventAssignment, CompleteResult, GameChoiceChallenges } from '@/types'
export const eventsApi = {
getActive: async (marathonId: number): Promise<ActiveEvent> => {
@@ -46,12 +46,18 @@ export const eventsApi = {
await client.delete(`/marathons/${marathonId}/swap-requests/${requestId}`)
},
rematch: async (marathonId: number, assignmentId: number): Promise<void> => {
await client.post(`/marathons/${marathonId}/rematch/${assignmentId}`)
// Game Choice event
getGameChoiceChallenges: async (marathonId: number, gameId: number): Promise<GameChoiceChallenges> => {
const response = await client.get<GameChoiceChallenges>(`/marathons/${marathonId}/game-choice/challenges`, {
params: { game_id: gameId },
})
return response.data
},
getDroppedAssignments: async (marathonId: number): Promise<DroppedAssignment[]> => {
const response = await client.get<DroppedAssignment[]>(`/marathons/${marathonId}/dropped-assignments`)
selectGameChoiceChallenge: async (marathonId: number, challengeId: number): Promise<{ message: string }> => {
const response = await client.post<{ message: string }>(`/marathons/${marathonId}/game-choice/select`, {
challenge_id: challengeId,
})
return response.data
},