Skip to content
Discussion options

You must be logged in to vote

Ok so I found a workaround that seems to be working quite well. I expose my fetcher with exposeFetcher: true and this will make the fetcher available to you:

useGetUserByEmailQuery.fetcher = (
  variables: GetUserByEmailQueryVariables,
  options?: RequestInit["headers"]
) =>
  fetcher<GetUserByEmailQuery, GetUserByEmailQueryVariables>(
    GetUserByEmailDocument,
    variables,
    options
  );

Then you can use it as you prefer:

useGetUserByEmailQuery
  .fetcher(
    { email: session.data?.user.email },
    {
      Authorization: `Bearer ${session.data?.access_token}`,
    }
  )()
  .then(({ users }) => {
    const userId = users?.[0].id;
    setUserId(userId);
  });

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ivorpad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant