Reverting change to promises.
This commit is contained in:
parent
295961edb1
commit
df56371ab6
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue