1
0
Fork 0
mirror of synced 2024-07-12 17:56:07 +12:00

Reverting change to promises.

This commit is contained in:
mike12345567 2024-06-20 16:36:18 +01:00
parent 295961edb1
commit df56371ab6

View file

@ -81,11 +81,15 @@ export async function search(
paginate: paginateObj as PaginationJson, paginate: paginateObj as PaginationJson,
includeSqlRelationships: IncludeRelationship.INCLUDE, includeSqlRelationships: IncludeRelationship.INCLUDE,
} }
let rows = await handleRequest(Operation.READ, tableId, parameters) const queries: Promise<Row[] | number>[] = []
let totalRows: number | undefined queries.push(handleRequest(Operation.READ, tableId, parameters))
if (countRows) { if (countRows) {
totalRows = await handleRequest(Operation.COUNT, tableId, parameters) queries.push(handleRequest(Operation.COUNT, tableId, parameters))
} }
const responses = await Promise.all(queries)
let rows = responses[0] as Row[]
const totalRows =
responses.length > 1 ? (responses[1] as number) : undefined
let hasNextPage = false let hasNextPage = false
// remove the extra row if it's there // remove the extra row if it's there