From 0b18bf0813b8ca05a0015f1cdbe58ff3931264b5 Mon Sep 17 00:00:00 2001 From: Charles Bachmeier Date: Tue, 29 Nov 2022 13:24:15 -0800 Subject: [PATCH] feat: remove gated key for graphql query (#5447) remove gated key for graphql query Co-authored-by: Charles Bachmeier --- src/graphql/data/fetchGraphQL.ts | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/src/graphql/data/fetchGraphQL.ts b/src/graphql/data/fetchGraphQL.ts index cd105b882b..dcb7fa3597 100644 --- a/src/graphql/data/fetchGraphQL.ts +++ b/src/graphql/data/fetchGraphQL.ts @@ -7,34 +7,15 @@ if (!GRAPHQL_URL) { throw new Error('AWS URL MISSING FROM ENVIRONMENT') } -const baseHeaders = { +const headers = { 'Content-Type': 'application/json', } -const nftHeaders = { - 'Content-Type': 'application/json', - 'x-api-key': process.env.REACT_APP_NFT_AWS_X_API_KEY ?? '', -} - -// The issue below prevented using a custom var in metadata to gate which queries are for the nft endpoint vs base endpoint -// This is a temporary solution before the two endpoints merge -// https://github.com/relay-tools/relay-hooks/issues/215 -const NFT_QUERIES = [ - 'AssetQuery', - 'AssetPaginationQuery', - 'CollectionQuery', - 'DetailsQuery', - 'NftBalanceQuery', - 'NftBalancePaginationQuery', -] const fetchQuery = (params: RequestParameters, variables: Variables): Promise => { - const isNFT = NFT_QUERIES.includes(params.name) const body = JSON.stringify({ query: params.text, // GraphQL text from input variables, }) - // TODO: When gating is removed from gql endpoint, we can remove the isNFT check and just use base headers - const headers = isNFT ? nftHeaders : baseHeaders return fetch(GRAPHQL_URL, { method: 'POST', body, headers }) .then((res) => res.json())