diff --git a/apps/website/src/templates/profile.tsx b/apps/website/src/templates/profile.tsx index 360032808..f6040496d 100644 --- a/apps/website/src/templates/profile.tsx +++ b/apps/website/src/templates/profile.tsx @@ -7,19 +7,22 @@ import { drupalExecutor } from '../utils/drupal-executor'; export default function ProfilePage() { const session = useSession(); - let accessToken = null; + let accessToken: string | undefined = undefined; if (session && session.status === 'authenticated') { // @ts-ignore accessToken = session.data.user.tokens.access_token; const authenticatedExecutor = drupalExecutor( `${process.env.GATSBY_DRUPAL_URL}/graphql`, false, - accessToken, ); return ( { - const data = await authenticatedExecutor(CurrentUserQuery, {}); + const data = await authenticatedExecutor( + CurrentUserQuery, + {}, + accessToken, + ); return { currentUser: data.currentUser, }; diff --git a/apps/website/src/utils/drupal-executor.ts b/apps/website/src/utils/drupal-executor.ts index 135dc85c4..2d9e79487 100644 --- a/apps/website/src/utils/drupal-executor.ts +++ b/apps/website/src/utils/drupal-executor.ts @@ -3,14 +3,11 @@ import { AnyOperationId, OperationVariables } from '@custom/schema'; /** * Create an executor that operates against a Drupal endpoint. */ -export function drupalExecutor( - endpoint: string, - forward: boolean = true, - accessToken: string | undefined = undefined, -) { +export function drupalExecutor(endpoint: string, forward: boolean = true) { return async function ( id: OperationId, variables?: OperationVariables, + accessToken?: string, ) { const url = new URL(endpoint, window.location.origin); const isMutation = id.includes('Mutation:'); diff --git a/packages/schema/src/index.ts b/packages/schema/src/index.ts index ba8d26957..42559e8d3 100644 --- a/packages/schema/src/index.ts +++ b/packages/schema/src/index.ts @@ -39,11 +39,10 @@ export function OperationExecutor( export function useExecutor( id: OperationId, variables?: OperationVariables, - accessToken?: string, ): | OperationResult | (( variables?: OperationVariables, ) => Promise>) { - return untypedUseExecutor(id, variables, accessToken); + return untypedUseExecutor(id, variables); }