aboutsummaryrefslogtreecommitdiffstats
path: root/src/services/graphql/client.ts
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2021-12-13 16:42:50 +0100
committerArmand Philippot <git@armandphilippot.com>2021-12-13 16:52:33 +0100
commit5bc55ac0a801cbe82c41a10f7e680612be4deaf8 (patch)
tree9dbfada52bdc4750cca60e9bc8b8fd63cf9a4737 /src/services/graphql/client.ts
parent8c836de71b47744ec3e99cb8b3c853528fa66b52 (diff)
chore: create homepage with graphql data
Diffstat (limited to 'src/services/graphql/client.ts')
-rw-r--r--src/services/graphql/client.ts12
1 files changed, 12 insertions, 0 deletions
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;
+};