From 5bc55ac0a801cbe82c41a10f7e680612be4deaf8 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Mon, 13 Dec 2021 16:42:50 +0100 Subject: chore: create homepage with graphql data --- src/services/graphql/client.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/services/graphql/client.ts (limited to 'src/services/graphql/client.ts') diff --git a/src/services/graphql/client.ts b/src/services/graphql/client.ts new file mode 100644 index 0000000..160021b --- /dev/null +++ b/src/services/graphql/client.ts @@ -0,0 +1,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; +}; -- cgit v1.2.3