const LIMIT = 7
export const getHoldings = async ({pageParam}: {pageParam: number}) => {
return (
await AxiosInstance.get(`/asset/user?page=${pageParam}&limit=${LIMIT}`)
).data
}
// this on the hook
export const useEmployeesWithHoldings = () => {
return useInfiniteQuery({
initialPageParam: 1,
queryKey: ['usersWithHoldings'],
queryFn: ({ pageParam = 1 }) => getHoldings({ pageParam }),
getNextPageParam: (lastPage, allPages) => {
return lastPage.totalPages > allPages.length ? allPages.length + 1 : undefined;
},
});
}
const LIMIT = 7
export const getHoldings = async ({pageParam}: {pageParam: number}) => {
return (
await AxiosInstance.get(`/asset/user?page=${pageParam}&limit=${LIMIT}`)
).data
}
// this on the hook
export const useEmployeesWithHoldings = () => {
return useInfiniteQuery({
initialPageParam: 1,
queryKey: ['usersWithHoldings'],
queryFn: ({ pageParam = 1 }) => getHoldings({ pageParam }),
getNextPageParam: (lastPage, allPages) => {
return lastPage.totalPages > allPages.length ? allPages.length + 1 : undefined;
},
});
}