Using prefetchInfiniteQuery with a fn that takes multiple params

I'm currently facing an issue when trying to prefetch
export async function getServerSideProps() {
  const queryClient = new QueryClient();

  await queryClient.prefetchInfiniteQuery({
    queryKey: ['variants'],
    queryFn: async () => {
      const accessToken = await getToken();
      return getVariants({ accessToken });
    },
    initialPageParam: 1,
  });

  return {
    props: {
      dehydratedState: dehydrate(queryClient),
    },
  };
}

function MyPage () {
  const { data, fetchNextPage } = useInfiniteQuery({
    queryKey: ['variants'],
    initialPageParam: 1,
    getNextPageParam: (lastPage) => lastPage.nextPage,
  })

the function getVariants takes a token argument and an optional page argument that defaults to
1
.

What would be the correct approach to make the infiniteQuery work?
Was this page helpful?