aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/hooks/use-article.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-08-20 21:39:51 +0200
committerArmand Philippot <git@armandphilippot.com>2022-08-20 21:39:51 +0200
commita0d00743cbbdb77b27c1a3d5711407ffed5befac (patch)
treef4caab160daf6b93c74d60ab93edd265c8edb158 /src/utils/hooks/use-article.tsx
parent46b158bf9d2f7fa9cc253915151e0b53c052a444 (diff)
refactor(types): move and rename GraphQL types
The api file in services was not really readable. So I move the types and I also rewrite a little the fetch function. I also rename most of the type to avoid conflict with preexisting types (like Node) and to keep consistency.
Diffstat (limited to 'src/utils/hooks/use-article.tsx')
-rw-r--r--src/utils/hooks/use-article.tsx6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/utils/hooks/use-article.tsx b/src/utils/hooks/use-article.tsx
index 6281a54..e658407 100644
--- a/src/utils/hooks/use-article.tsx
+++ b/src/utils/hooks/use-article.tsx
@@ -1,4 +1,4 @@
-import { fetchAPI, getAPIUrl } from '@services/graphql/api';
+import { fetchAPI } from '@services/graphql/api';
import { getArticleFromRawData } from '@services/graphql/articles';
import { articleBySlugQuery } from '@services/graphql/articles.query';
import { Article } from '@ts/types/app';
@@ -22,9 +22,7 @@ const useArticle = ({
fallback,
}: UseArticleConfig): Article | undefined => {
const { data } = useSWR(
- slug
- ? { api: getAPIUrl(), query: articleBySlugQuery, variables: { slug } }
- : null,
+ slug ? { query: articleBySlugQuery, variables: { slug } } : null,
fetchAPI<RawArticle, typeof articleBySlugQuery>
);