aboutsummaryrefslogtreecommitdiffstats
path: root/src/services/graphql/api.ts
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-04-29 12:13:34 +0200
committerArmand Philippot <git@armandphilippot.com>2022-04-29 18:30:05 +0200
commit7e16f500cb7bc0cfd8bafbf6bb1555704f771231 (patch)
treebfc2b4a475cb06a787e2c4bdf284165644e82952 /src/services/graphql/api.ts
parent5324664e87bedfaa01ba62c0c847ef5b861e69b3 (diff)
chore: remove old pages, components, helpers and types
Since I'm using new components, I will also rewrite the GraphQL queries so it is easier to start from scratch.
Diffstat (limited to 'src/services/graphql/api.ts')
-rw-r--r--src/services/graphql/api.ts25
1 files changed, 0 insertions, 25 deletions
diff --git a/src/services/graphql/api.ts b/src/services/graphql/api.ts
deleted file mode 100644
index a5be026..0000000
--- a/src/services/graphql/api.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { RequestType, VariablesType } from '@ts/types/app';
-import { settings } from '@utils/config';
-import { GraphQLClient } from 'graphql-request';
-
-export const getGraphQLClient = (): GraphQLClient => {
- const apiUrl = settings.api.url;
-
- if (!apiUrl) throw new Error('API URL not defined.');
-
- return new GraphQLClient(apiUrl);
-};
-
-export const fetchApi = async <T extends RequestType>(
- query: string,
- variables: VariablesType<T>
-): Promise<T> => {
- const client = getGraphQLClient();
-
- try {
- return await client.request(query, variables);
- } catch (error) {
- console.error(error, undefined, 2);
- process.exit(1);
- }
-};