summaryrefslogtreecommitdiffstats
path: root/src/services/graphql/client.ts
blob: 160021bccc0b5b9c6824c62783918aca1ab03827 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import { GraphQLClient } from 'graphql-request';

export const getGraphQLClient = () => {
  const apiUrl: string = process.env.NEXT_PUBLIC_GRAPHQL_API || '';
  console.log(apiUrl);

  if (!apiUrl) throw new Error('API URL not defined.');

  const graphQLClient = new GraphQLClient(apiUrl);

  return graphQLClient;
};