const {
data,
isLoading,
error,
hasNextPage,
isFetchingNextPage,
fetchNextPage,
} = api.products.getAllByLocationPaginated.useInfiniteQuery(
{ cursor: page, location },
{
enabled: locationSelected,
getNextPageParam: (lastPage) =>
lastPage.currentPage === lastPage.totalPages ? null : lastPage.nextPage,
getPreviousPageParam: (page) => page.prevPage,
}
);
const {
data,
isLoading,
error,
hasNextPage,
isFetchingNextPage,
fetchNextPage,
} = api.products.getAllByLocationPaginated.useInfiniteQuery(
{ cursor: page, location },
{
enabled: locationSelected,
getNextPageParam: (lastPage) =>
lastPage.currentPage === lastPage.totalPages ? null : lastPage.nextPage,
getPreviousPageParam: (page) => page.prevPage,
}
);