Convert market to lite market for Phil
This commit is contained in:
parent
ad18987e65
commit
87060488f5
|
@ -86,9 +86,10 @@ export async function listGroupContracts(groupId: string) {
|
|||
contractId: string
|
||||
createdTime: number
|
||||
}>(groupContracts(groupId))
|
||||
return Promise.all(
|
||||
const contracts = await Promise.all(
|
||||
contractDocs.map((doc) => getContractFromId(doc.contractId))
|
||||
)
|
||||
return filterDefined(contracts)
|
||||
}
|
||||
|
||||
export function listenForOpenGroups(setGroups: (groups: Group[]) => void) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { applyCorsHeaders, CORS_UNRESTRICTED } from 'web/lib/api/cors'
|
||||
import { listGroupContracts } from 'web/lib/firebase/groups'
|
||||
import { toLiteMarket } from 'web/pages/api/v0/_types'
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
|
@ -8,7 +9,9 @@ export default async function handler(
|
|||
) {
|
||||
await applyCorsHeaders(req, res, CORS_UNRESTRICTED)
|
||||
const { id } = req.query
|
||||
const contracts = await listGroupContracts(id as string)
|
||||
const contracts = (await listGroupContracts(id as string)).map((contract) =>
|
||||
toLiteMarket(contract)
|
||||
)
|
||||
if (!contracts) {
|
||||
res.status(404).json({ error: 'Group not found' })
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue
Block a user