1 import type { Api } from '../../interfaces';
3 const MAX_ITERATIONS = 100;
5 const paginatedFetch = async <T>(
7 cb: (pageNumber: number, pageSize: number) => Promise<T[]>,
14 while (pageNumber < max) {
15 const page = await cb(pageNumber, pageSize);
16 result = result.concat(page);
17 if (page.length !== pageSize) {
26 export default paginatedFetch;