Add challenges promotion
This commit is contained in:
@@ -79,6 +79,11 @@ export const gamesApi = {
|
||||
await client.delete(`/challenges/${id}`)
|
||||
},
|
||||
|
||||
updateChallenge: async (id: number, data: Partial<CreateChallengeData>): Promise<Challenge> => {
|
||||
const response = await client.patch<Challenge>(`/challenges/${id}`, data)
|
||||
return response.data
|
||||
},
|
||||
|
||||
previewChallenges: async (marathonId: number, gameIds?: number[]): Promise<ChallengesPreviewResponse> => {
|
||||
const data = gameIds?.length ? { game_ids: gameIds } : undefined
|
||||
const response = await client.post<ChallengesPreviewResponse>(`/marathons/${marathonId}/preview-challenges`, data)
|
||||
@@ -89,4 +94,30 @@ export const gamesApi = {
|
||||
const response = await client.post<{ message: string }>(`/marathons/${marathonId}/save-challenges`, { challenges })
|
||||
return response.data
|
||||
},
|
||||
|
||||
// Proposed challenges
|
||||
proposeChallenge: async (gameId: number, data: CreateChallengeData): Promise<Challenge> => {
|
||||
const response = await client.post<Challenge>(`/games/${gameId}/propose-challenge`, data)
|
||||
return response.data
|
||||
},
|
||||
|
||||
getProposedChallenges: async (marathonId: number): Promise<Challenge[]> => {
|
||||
const response = await client.get<Challenge[]>(`/marathons/${marathonId}/proposed-challenges`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
getMyProposedChallenges: async (marathonId: number): Promise<Challenge[]> => {
|
||||
const response = await client.get<Challenge[]>(`/marathons/${marathonId}/my-proposed-challenges`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
approveChallenge: async (id: number): Promise<Challenge> => {
|
||||
const response = await client.patch<Challenge>(`/challenges/${id}/approve`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
rejectChallenge: async (id: number): Promise<Challenge> => {
|
||||
const response = await client.patch<Challenge>(`/challenges/${id}/reject`)
|
||||
return response.data
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user