aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-11-16 18:16:09 +0100
committerArmand Philippot <git@armandphilippot.com>2023-11-16 18:16:09 +0100
commitdcd2a7ab382fece8e0ae2979aad4a180b6a105e1 (patch)
tree0e58f8a5b4977eb0c9ff9759484ecded72bd7e38 /src/utils
parent4bdbca861293357bb7928c6c7a5990be9f37380b (diff)
build(components, hooks): fix type errors introduced by deps upgrade
Since #7e37f2b Typescript was complaining about some types.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/hooks/use-article.ts (renamed from src/utils/hooks/use-article.tsx)5
-rw-r--r--src/utils/hooks/use-comments.ts (renamed from src/utils/hooks/use-comments.tsx)4
2 files changed, 5 insertions, 4 deletions
diff --git a/src/utils/hooks/use-article.tsx b/src/utils/hooks/use-article.ts
index 86d8e38..5cf0e51 100644
--- a/src/utils/hooks/use-article.tsx
+++ b/src/utils/hooks/use-article.ts
@@ -4,7 +4,7 @@ import {
fetchAPI,
getArticleFromRawData,
} from '../../services/graphql';
-import { type Article, type RawArticle } from '../../types';
+import type { Article, RawArticle } from '../../types';
export type UseArticleConfig = {
/**
@@ -29,7 +29,8 @@ export const useArticle = ({
}: UseArticleConfig): Article | undefined => {
const { data } = useSWR(
slug ? { query: articleBySlugQuery, variables: { slug } } : null,
- fetchAPI<RawArticle, typeof articleBySlugQuery>
+ fetchAPI<RawArticle, typeof articleBySlugQuery>,
+ {}
);
return data ? getArticleFromRawData(data.post) : fallback;
diff --git a/src/utils/hooks/use-comments.tsx b/src/utils/hooks/use-comments.ts
index 6ac3d42..ac723e9 100644
--- a/src/utils/hooks/use-comments.tsx
+++ b/src/utils/hooks/use-comments.ts
@@ -1,6 +1,6 @@
import useSWR from 'swr';
import { getAllComments } from '../../services/graphql';
-import { SingleComment } from '../../types';
+import type { SingleComment } from '../../types';
export type UseCommentsConfig = {
contentId?: string | number;
@@ -17,7 +17,7 @@ export const useComments = ({
contentId,
fallback,
}: UseCommentsConfig): SingleComment[] | undefined => {
- const { data } = useSWR(contentId ? { contentId } : null, getAllComments);
+ const { data } = useSWR(contentId ? { contentId } : null, getAllComments, {});
return data ?? fallback;
};