Add bot to play against.
This commit is contained in:
+4
-2
@@ -13,8 +13,10 @@ async function post(path: string, body: unknown): Promise<Session> {
|
||||
return data as Session
|
||||
}
|
||||
|
||||
export function createGame(name: string): Promise<Session> {
|
||||
return post('/api/games', { name })
|
||||
export type BotDifficulty = 'easy' | 'medium' | 'hard'
|
||||
|
||||
export function createGame(name: string, bot?: BotDifficulty): Promise<Session> {
|
||||
return post('/api/games', bot ? { name, bot } : { name })
|
||||
}
|
||||
|
||||
export function joinGame(code: string, name: string): Promise<Session> {
|
||||
|
||||
Reference in New Issue
Block a user