Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Commit

Permalink
use api limit+offset
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Dec 31, 2021
1 parent 29466c8 commit d3e7eca
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/src/hooks/use_infinite_fetch.js
Expand Up @@ -41,12 +41,12 @@ export function useInfiniteFetch(apiPath, fetcher) {
offset,
};

const promise = fetcher(apiPath);
const promise = fetcher(`${apiPath}?offset=${offset}&limit=${LIMIT}`);

promise.then((allData) => {
promise.then((nextData) => {
setResult((cur) => ({
...cur,
data: [...cur.data, ...allData.slice(offset, offset + LIMIT)],
data: [...cur.data, ...nextData],
isLoading: false,
}));
internalRef.current = {
Expand Down

0 comments on commit d3e7eca

Please sign in to comment.