Add challenges preview + makefile
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import client from './client'
|
||||
import type { Game, Challenge } from '@/types'
|
||||
import type { Game, Challenge, ChallengePreview, ChallengesPreviewResponse } from '@/types'
|
||||
|
||||
export interface CreateGameData {
|
||||
title: string
|
||||
@@ -63,8 +63,13 @@ export const gamesApi = {
|
||||
await client.delete(`/challenges/${id}`)
|
||||
},
|
||||
|
||||
generateChallenges: async (marathonId: number): Promise<{ message: string }> => {
|
||||
const response = await client.post<{ message: string }>(`/marathons/${marathonId}/generate-challenges`)
|
||||
previewChallenges: async (marathonId: number): Promise<ChallengesPreviewResponse> => {
|
||||
const response = await client.post<ChallengesPreviewResponse>(`/marathons/${marathonId}/preview-challenges`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
saveChallenges: async (marathonId: number, challenges: ChallengePreview[]): Promise<{ message: string }> => {
|
||||
const response = await client.post<{ message: string }>(`/marathons/${marathonId}/save-challenges`, { challenges })
|
||||
return response.data
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user