feat: add challenge and red-blue competitions across API and web
This commit is contained in:
parent
f5161d9add
commit
8fd3c4bb64
77 changed files with 5355 additions and 24 deletions
24
web/service/redBlueChallenges.ts
Normal file
24
web/service/redBlueChallenges.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { getPublic, postPublic } from './base'
|
||||
|
||||
export type RedBlueListItem = {
|
||||
id: string
|
||||
name: string
|
||||
description?: string
|
||||
}
|
||||
|
||||
export async function fetchRedBlueChallenges(): Promise<RedBlueListItem[]> {
|
||||
const res = await getPublic<{ result: string; data: RedBlueListItem[] }>('/red-blue-challenges')
|
||||
return res.data ?? []
|
||||
}
|
||||
|
||||
export async function fetchRedBlueLeaderboard(id: string) {
|
||||
const res = await getPublic<{ result: string; data: any }>(`/red-blue-challenges/${id}/leaderboard`)
|
||||
return res.data
|
||||
}
|
||||
|
||||
export async function submitRedBluePrompt(id: string, team: 'red' | 'blue', prompt: string) {
|
||||
const res = await postPublic<{ result: string; data: any }>(`/red-blue-challenges/${id}/submit`, {
|
||||
body: { team, prompt },
|
||||
})
|
||||
return res.data
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue