Add support for up to 6 players.
This commit is contained in:
+5
-3
@@ -23,9 +23,11 @@ export function joinGame(code: string, name: string): Promise<Session> {
|
||||
return post('/api/join', { code, name })
|
||||
}
|
||||
|
||||
export async function fetchCatalog(pack?: string): Promise<Card[]> {
|
||||
const url = pack ? `/api/catalog?pack=${encodeURIComponent(pack)}` : '/api/catalog'
|
||||
const res = await fetch(url)
|
||||
export async function fetchCatalog(packs?: string[]): Promise<Card[]> {
|
||||
const query = (packs ?? [])
|
||||
.map((p) => `pack=${encodeURIComponent(p)}`)
|
||||
.join('&')
|
||||
const res = await fetch(query ? `/api/catalog?${query}` : '/api/catalog')
|
||||
if (!res.ok) throw new Error('failed to load catalog')
|
||||
return (await res.json()) as Card[]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user