UNPKG

744 BTypeScriptView Raw
1import { QueryResult } from 'react-apollo';
2import { DocumentNode } from 'graphql';
3import { Route } from '../types';
4interface QueryVariables {
5 offset: number;
6 first: number;
7}
8declare const useInfinitePagination: ({ result, query }: {
9 result: QueryResult<{
10 route: Route;
11 }, QueryVariables>;
12 query: DocumentNode;
13}) => {
14 previous: {
15 loadingProducts: boolean;
16 hasProducts: boolean;
17 fetchProducts: () => void;
18 offset: number;
19 page: number;
20 };
21 next: {
22 loadingProducts: boolean;
23 hasProducts: boolean;
24 fetchProducts: () => void;
25 offset: number;
26 page: number;
27 };
28 products: any[];
29};
30export default useInfinitePagination;