aboutsummaryrefslogtreecommitdiffstats
path: root/src/services/graphql/api.ts
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-01-04 13:35:25 +0100
committerArmand Philippot <git@armandphilippot.com>2022-01-04 13:35:25 +0100
commitd53d375d09dd86a85ffb249de1c0cc7c3b3438bc (patch)
tree827e02f739a542e674e5d447f46ee97096f02cd7 /src/services/graphql/api.ts
parentab5e5f4bdf40b5bc1ccf82dc1b4aca94d5171ec3 (diff)
refactor: avoid useless assignement before return statement
Diffstat (limited to 'src/services/graphql/api.ts')
-rw-r--r--src/services/graphql/api.ts7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/services/graphql/api.ts b/src/services/graphql/api.ts
index de8024f..33cc89a 100644
--- a/src/services/graphql/api.ts
+++ b/src/services/graphql/api.ts
@@ -6,9 +6,7 @@ export const getGraphQLClient = (): GraphQLClient => {
if (!apiUrl) throw new Error('API URL not defined.');
- const graphQLClient = new GraphQLClient(apiUrl);
-
- return graphQLClient;
+ return new GraphQLClient(apiUrl);
};
export const fetchApi = async <T extends RequestType>(
@@ -18,8 +16,7 @@ export const fetchApi = async <T extends RequestType>(
const client = getGraphQLClient();
try {
- const response = await client.request(query, variables);
- return response;
+ return await client.request(query, variables);
} catch (error) {
console.error(error, undefined, 2);
process.exit(1);